superagent icon indicating copy to clipboard operation
superagent copied to clipboard

url pdf file with filename attached put request

Open daskabe opened this issue 3 years ago • 0 comments

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")
   })

daskabe avatar Jun 29 '22 05:06 daskabe