Thursday 19 January 2017

How can I avoid creating resources in my server?

To provide some background information, I have a simple app that takes form input from the browser, creates a PDF from it using the pdflatex command, and then sends the PDF back to the browser to be downloaded.Here is my file structure:. ├── app.js ├── doc.cls └── doc.tex And here is my relevant app.js code:const { spawn } = require('child_process') spawn('pdflatex', ['doc.tex']) When this code runs, a doc.pdf and doc.log file gets created. What I'm trying to do is avoid actually creating any files at all, and just somehow stream the doc.pdf straight to the browser as a response.Is this possible or do I have to do something like send the doc.pdf as a response and then delete the doc.pdf and doc.log file immediately afterwards manually?Any help would be appreciated.

Submitted January 19, 2017 at 09:44PM by inhwre

No comments:

Post a Comment