Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Implement using stdin and stdout with Prince #46

Open
PaulSearcy opened this issue Jan 20, 2023 · 3 comments
Open

Feature request: Implement using stdin and stdout with Prince #46

PaulSearcy opened this issue Jan 20, 2023 · 3 comments

Comments

@PaulSearcy
Copy link

PaulSearcy commented Jan 20, 2023

Thank you for writing this wrapper around Prince! It helped speed up my understanding of how to call Prince via a child process.

https://www.princexml.com/doc/command-line/#specifying-input-and-output

Prince called directly with the first argument - waits for stdin and passes back to stdout when - is passed to -o

ex. cat test.html | prince - -o -

Unfortunately, I have a need to be able to run Prince on lambda and having file I/O was some overhead that I needed to eliminate.

Following this example on how to run Prince on Lambda. I was able to write my own JS that handles this for my use case.

That being said I really like the API surface you provide here in this library and was hoping you could add something to address this. Whether that be a special chain able method or a modification to Prince.prototype.inputs and/or Prince.prototype.output

@PaulSearcy PaulSearcy changed the title Feature request: Allow passing inputs as stdin to Prince Feature request: Implement using stdin and stdout with Prince Jan 20, 2023
@GetPsyched
Copy link

I would also love seeing this library accept and return I/O from memory rather than having to do file I/O just for this lib.

Here's a snippet of my code which does file I/O for things that I already have in memory:
https://github.com/GetPsyched/printer/blob/30c4fa685eb7a603d193aa37488c2eab9481a21c/src/routes/pdf/%2Bserver.ts#L24-L36

I would really appreciate if node-prince allowed for I/O without files on disk. This feature would allow me to finally host on Cloudflare Pages.

@GetPsyched
Copy link

I am willing to PR this in as well if the maintainers are interested!

@miquik
Copy link

miquik commented May 21, 2024

Well you can use control protocol to do that. You can create a child_process (spawn) passing -control as arguments. Now you can pipe stdin and stdout of child_process to any buffer or stream both in input or output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants