3

I want to upload pdf file created by pdfmake to remote server. For that I am using following code roughly.

    const doc = printer.createPdfKitDocument(docDefinition);
    doc.pipe(fs.createWriteStream(filename))


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

But issue with above approach is it requires to create file locally. I want to avoid that and want to take output from pdfmake and send it directly to server. How can I do that ?

rainyday
  • 353
  • 3
  • 17

0 Answers0