let fd = new FormData()
fd.append('file', fs.createReadStream('ddd.jpg'), 'ddd.jpg')
let form = {
"photo": fd
}
let headers = {
"Content-Type": "multipart/form-data",
}
request.post({
url: data.response.upload_url,
form: form,
headers: headers
}, (a,b,c) => {
console.log(c)
})
var request = require('request');
var fs = require('fs');
var options = {
'method': 'GET',
'url': 'ya.ru',
'headers': {
},
formData: {
'aa': {
'value': fs.createReadStream('/C:/Users/Sergei-Pc/Pictures/2019-06-02/002.jpg'),
'options': {
'filename': '/C:/Users/Sergei-Pc/Pictures/2019-06-02/002.jpg',
'contentType': null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});