Code:
function UploadImage(id, url) { console.log([id, url]); request(url).pipe(fs.createWriteStream(id + '.png')) unirest.post('https://app.ecwid.com/api/v3/' + apikeys[0] + '/products/' + id + '/image?token=' + apikeys[1]) .headers({'Content-Type': 'application/json'}) .attach('file', id + '.png') .end(function (response) { console.log(response.statusCode); console.log(response.body); }); }
Any help would be great.