Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joojscript/enginer
An utility js/ts library to make Javacript conccurent!
https://github.com/joojscript/enginer
Last synced: about 1 month ago
JSON representation
An utility js/ts library to make Javacript conccurent!
- Host: GitHub
- URL: https://github.com/joojscript/enginer
- Owner: joojscript
- Created: 2021-08-06T20:47:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-19T12:52:00.000Z (over 2 years ago)
- Last Synced: 2024-01-26T20:04:36.405Z (11 months ago)
- Language: TypeScript
- Homepage:
- Size: 778 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
EnginerAn utility js/ts library to make Javacript 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
```shell
npm install enginer
```or
```shell
yarn add enginer
```⚠ **warning**: Typescript is **not** a required dependecy, as this library works without it. But if your code is in ts, you need to have it installed.
## Usage
### Single Worker
```typescript
const filepath = resolve(__dirname, "file.ts");new Worker({ filepath });
```### Worker Pool
```typescript
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](https://choosealicense.com/licenses/mit/)