process-as-promised
v1.0.1
Published
This is a small lib for (mostly) promisified process ipc communication
Downloads
16
Readme
Process as Promised
/*
a simple example
you could also take a look in /test
*/
// parent process
const p = new ProcessAsPromised(process.fork('child'));
p.send('info', 'now').then(res => {
console.log(res) // {stats: 12, memes: 69}
});
// child process
const p = new ProcessAsPromised();
p.on('info', (data, callback) => {
if (data === 'now') callback({stats: 12, memes: 69});
else setTimeout(() => {
callback({stats: 12, memes: 69});
}, 1000);
});
Reasons to use:
- No dependancies!
- Oh-so useful
- insanely performant
- Can be used with async/await