How can we send file with phin?
Dobby85 opened this issue · comments
devDobby commented
Hi,
I'm trying sending a file with phin but without results. I tried in data of in form, nothing works.
Is there a way to send a file with phin? If yes, how can we do it?
Thanks,
Maxime
Ethan commented
Hi! To send a file, simply set the body of your request to the file data like so...
const fileBuffer = fs.readFileSync(path.join(__dirname, 'myfile.png'))
await p({
'url': 'https://ethanent.me/nonexistentEndpoint',
'method': 'POST',
'data': fileBuffer
})