superagent
superagent copied to clipboard
url pdf file with filename attached put request
i have a pdf file url. i need to send it with superagent with fileName param. is there example of this? this is not working
const urlf = 'http://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf';
const s = await http.get(urlf, (stream) => {
return stream;
});
let req = superagent
.put(`${url}/attachFile`)
.auth(apiUserName, password)
req.attach('fileName', "dummy.pdf");
req.pipe(s)
.end(() => {
console.log("attachement upload")
})