title: Send Puppeteer Generated Pdf to another microservice using requestPromise npm
body: <p>I have two microservices: 1) in which I am generating pdf using Puppeteer, which is essentially a Buffer object. From this service I want to send the pdf to another microservice, 2) which receives the pdf in request and attaches it in email using mailgun (once I am able to send pdf from one service to another, attaching as an email wont be difficult).
  The way I m sending the pdf in requestpromise is this:</p>
  <pre><code>import requestPromise from &quot;request-promise&quot;;
  import {Readable} from &quot;stream&quot;;
  
  //pdfBuffer is result of 'await page.pdf({format: &quot;a4&quot;});' (Puppeteer method).
  
  const stream = Readable.from(pdfBuffer); 
  /*also tried DUPLEX and Readable.from(pdfBuffer.toString()) and this code too.
     const readable = new Readable();
     readable._read = () =&gt; {}
     readable.push(pdf);
     readable.push(null);
  */
  
  requestPromise({
          method: &quot;POST&quot;,
          url: `${anotherServiceUrl}`,
          body: {data},
          formData: {
              media: {
                  value: stream,
                  options: {
                      filename: &quot;file.pdf&quot;,
                      knownLength: pdfBuffer.length,
                      contentType: &quot;application/pdf&quot;
                  }
              }
          },
          json: true
      }
  });
  </code></pre>
  <p>But doing so, I get &quot;ERR_STREAM_WRITE_AFTER_END&quot; error. How can I send this pdf from one service to another, since the other service sends the email to the user?</p>