Add Java-like multi-threading to node.js applications, without having to write a separate file.
Thread.js has one method that you pass a function to. It will then run that function on a separate thread.
var threadjs = require('thread.js');
threadjs.runTask(function () {
for (var i = 0; i < 100000, i++) {
}
console.log("Done.");
});
The runTask method converts the passed-in function into a string. And then, it will spawn a new node.js process, with the function's string as a command-line argument.