Here are my files:
.
├── app.js
├── res.cls
└── res.tex
And here is the relevant contents of my app.js file:
const { spawn } = require('child_process')
const latex = spawn('pdflatex', ['res.tex'])
Running this code successfully creates a res.pdf
file in the same directory. However, rather than creating a file, I would like to get the PDF as a stream and send it as a response to the browser instead. I'm trying to avoid creating any PDF files in the server, I just want to send the generated PDF as a response immediately. Is it possible to alter this code to do this?