title: Generate PDF with puppeteer without save it
body: <p>I have an API written with <code>node.js</code> hosted on <code>heroku</code> and my frontend app is written in <code>Vue.js</code>, it is on <code>hostinger</code>. I would like to know if is it possible to generate a PDF file with puppeteer and send it immediately to frontend client without saving it to the disk first? If yes, could you give me some example on how to do it?</p>
  
  <p>Currently my function is like that:</p>
  
  <pre><code>exports.gerarPDFAvaliacao = async (dadosAvaliacao) =&gt; {
      try {
          const compile = async (fileName, data) =&gt; {
  
              const filePath = path.join(process.cwd(), 'src/templates/client/operation/', `${fileName}.hbs`);
              const html = await fs.readFile(filePath, 'utf-8');
              return await hbs.compile(html)(data);
          }
  
          const browser = await puppeteer.launch();
          const page = await browser.newPage();
  
          let content = await compile('avaliations', dadosAvaliacao);
  
          await page.goto(`data:text/html,${content}`, { waitUntil: 'networkidle0' });
          await page.emulateMedia('screen');
          await page.pdf({
              path: 'src/dist/pdf/' + dadosAvaliacao.arquivo + '.pdf',
              format: 'A4',
              printBackground: true
          })
          await browser.close();
  
          return dadosAvaliacao.arquivo + '.pdf';
      } catch (error) {
          console.log('Errors =&gt; ', error);
      }
  };
  </code></pre>