[Vuejs]-Request in node works but in js (vue) doesnt

0👍

I think it’s probably not reading the path to index.png file correctly here, fs.createReadStream('index.png')

Consider using path like this

const path = require('path');

const filePath = path.join(__dirname,  'index.png');

data.append('file', fs.createReadStream(filePath))

NB: This is just a quick and dirty suggestion, and it’s not guaranteed to work but it’s definitely worth a shot

Leave a comment