process-as-promised

1.0.1 • Public • Published

Process as Promised

npm npm David

NPM

/*
  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:

  1. No dependancies!
  2. Oh-so useful
  3. insanely performant
  4. Can be used with async/await

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i process-as-promised

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • snek