0.0.2 • Published 3 years ago

enginer v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

An utility js/ts library to make Javscript conccurent!

Motivation

While trying to make high-scalable and performant systems, I end up being in contact with node.js' worker_threads which were trully nice! But unfortunelly, at least in my search, I could not find any implementations that support typescript.

I end up trying some work arounds, but, as a developer that likes a lot concurrency, I decided to make my own implementation. So here it is! Hope it helps! :)

Installation

npm install enginer

or

yarn add enginer

Usage

Single Worker

const filepath = resolve(__dirname, "file.ts");

new Worker({ filepath });

Worker Pool

const filepath = resolve(__dirname, "file.ts");

new Pool({
  max: 4,
  workers: [
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
    new Worker({ filepath }),
  ],
});

ToDo

  • 🕐 Support commands as well as files/scripts.

License

MIT