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

    Keywords

    none

    Install

    npm i process-as-promised

    DownloadsWeekly Downloads

    26

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • snek