Last active
March 8, 2019 02:19
-
-
Save stormoz/93eaa11b846ae413eaf374482842a72d to your computer and use it in GitHub Desktop.
Node JS: send binary file as multiform data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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