title: complex data manipulation in node.js using child processes
body: <p>I am new to node.js and in the position where I am using Node.js for a single page app. I have to occasionally do some very complex data manipulation (for AI and statistical functions). These services are written in Python. I am trying to figure out the best way to hand off these computations to a child process so my main thread is not blocked and I can use the abundance of python libraries available.</p>
  
  <p>I need to be able to pass complex data (a JSON object is fine) to the child process and receive complex output (again a JSON object is ideal). Referring to <a href="https://stackoverflow.com/questions/22131304/node-js-math-computation-child-process-and-complex-data">Node.js math computation - child process and complex data?</a>, this is simple enough with another node.js process using child_process.fork() and .send(). </p>
  
  <p>Is there a similar method in child_process.spawn()? Or is it possible to use .fork() to execute a python script. All I can figure out is how to execute system commands which don't allow but the most simple arguments. Even if I can send the data, I am unclear about how to receive data using .spawn().</p>
  
  <p>I couldn't find this answer on SO, but I admit node.js is new to me.</p>
  
  <p>Thank you.</p>