Skip to content

Instantly share code, notes, and snippets.

@stormoz
Last active March 8, 2019 02:19
Node JS: send binary file as multiform data
var formData = {
'myfile_key': {
value: <Buffer object>
options: {
filename: 'image_file'
}
}
};
const options = {
uri: url,
formData: formData,
method: 'POST'
}
request(options, (err, response, body) => {
console.log('Request complete');
if (err) console.log('Request err: ', err);
console.log(body)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment