简体   繁体   中英

Sending Images from nodejs to Python script via standard input/output

I am trying to send an image from node js script to python script using python-shell. From what I know, I should use binary format.

I know that in python side I can use this 2 functions:

import sys

sys.stdout.write() and sys.stdin.read()

But I am not sure how the node js side gonna be? (Which functions can I use and how can I use them?)

If you want to write in the standard input/output (stdin/stoud) in nodejs you can use process object stdin (a readable stream) and stdout (a writable stream) properties.

Example:

process.stdout.write('my output');

I tried to encode the image and send it but It did not work. So I used Socket programming instead and It worked wonderfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM