Sunday, 11 June 2017

How to fork a process in Node.js to run JS code from a buffer available in parent rather than from a file?

I am using

 child_process.fork(scriptFile) 

to fork a child process and to execute the JS in scriptFile. The problem is that I want to optimize it because the JS code I want to run is already available in a buffer in the parent. I am now writing it to a file and then specifying that path to child_process.fork. This involves two redundant I/O. First I write the JS to a file in the parent. It is then read by the child process.

Any way to prevent this?



via Sam

No comments:

Post a Comment