If you create a new V8 process through .fork() , it returns a new child object that implements the link layer. For instance,
var cp = require( 'child_process' ), proc = cp.fork( '/myfile.js' ); proc.on('message', function( msg ) {
and inside /myfile.js you just send the event when you are done
process.send({ custom: 'message' });
Remember that this method actually spawns a new instance of V8 that eats a good chunk of memory. Therefore, you should use this very thoughtfully. Maybe you donβt even have to do this, maybe there is a more βnode likeβ solution (using process.nextTick to calculate heavy data).
jAndy source share