0

I am trying to upload a string which stores contents of a pdf in base64 to server. In my earlier approach I was using following code

  var form = new FormData();
  form.append("file", fs.createReadStream(filePath));
  let response=await axios.post(url, form,  {headers: {
    ...form.getHeaders(),
  }});

But in this approach I had to write string contents to temporary file first. I want to avoid it. So I need some help. The data in string is obtained from PDFMake tool.

rainyday
  • 353
  • 3
  • 17
  • https://stackoverflow.com/questions/8390855/how-to-instantiate-a-file-object-in-javascript – Max Aug 20 '19 at 17:17
  • Possible duplicate of [How to instantiate a File object in JavaScript?](https://stackoverflow.com/questions/8390855/how-to-instantiate-a-file-object-in-javascript) – Max Aug 20 '19 at 17:18
  • @Max This question is related to nodejs – rainyday Aug 20 '19 at 17:33

0 Answers0