Can't upload image file using Wordpress REST API (Node JS)
You'll want to change the formData
of your request to specify media as follows:
var formData = { title: 'Post title', content: 'Post body', 'media[0]': fs.createReadStream('local/path/to/image.jpg')}
Any additional media should increment the index. You can similarly specify attributes by index:
'media_attrs[0][caption]': 'My Great Photo'