{"_id":"worker-threads-pool","_rev":"2-42a81db53967154b7cd739337c958c78","name":"worker-threads-pool","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"worker-threads-pool","version":"1.0.0","description":"Easily manage a pool of Node.js Worker Threads","main":"index.js","directories":{"test":"test"},"dependencies":{"after-all":"^2.0.2"},"devDependencies":{"standard":"^11.0.1","tape":"^4.9.1"},"scripts":{"test":"standard && node --experimental-worker test/test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/worker-threads-pool.git"},"engines":{"node":">=10.5.0"},"keywords":["pool","worker","workers","thread","threads","worker_threads","parallel"],"author":{"name":"Thomas Watson","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/worker-threads-pool/issues"},"homepage":"https://github.com/watson/worker-threads-pool#readme","coordinates":[55.777612,12.590162],"gitHead":"8960b3236d5e4656e6b9eb8552b4123e8df56bf5","_id":"worker-threads-pool@1.0.0","_npmVersion":"6.1.0","_nodeVersion":"10.5.0","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-vbR847zIKVy1h8ayGO/J3WmnVnfMrKpVdHPGY5MmPeDfK5eQ10VpgdFXB2mnbFMN168Y6p+eYfZZ4GjrZiLSqg==","shasum":"11b287e6c5778d9797abb3ccc0d025263fc9cfc9","tarball":"https://registry.npmjs.org/worker-threads-pool/-/worker-threads-pool-1.0.0.tgz","fileCount":4,"unpackedSize":5151,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbL8aACRA9TVsSAnZWagAAad4P/0J9RpfKMDQpW30xcuip\n3ddfc0Rrjc68PvMdRFNF56zwjDM287SzhO4EBhcdohyFA54A3LpbVdhAiBC+\nbWuRbm0WtV11Kkhu5Xf+CulcucOI8nT//qqZko/RIlgAtl6xcBxnv4zaSZW6\nTmoxUlvvoMB+UX0JXkM/sJ0NCcOD5l69T8JeJ45VRlL+pIc++J2lpbmyghEa\nx01hNs+wZvYmN5iP8e8eGBm0+zcycp5kjGyeWlgmT+xi/uBPu9SsArSUUL40\nnISgKsG9PC7VlQQhKFTNP2KQLHrpCjzWeaiKZmzOUE61fR/cRE8GTwwaqZQl\nPQu1n80Ah/Eb3VEiTyyKQ2A9VGZKXAmqvzswE4P+02jFYtDH34BxwQKFHXif\nHLx8tQQtHyqxbiEL2VkRF6rExXNG9KT6CJMRddRzjwpYXyjrl+0mgypj09uy\ncm7svGg8uZqOqeblPqmq7COhcC2hc0IY1BpjR3Q4+sOzF/qHDt+0pShqsRsq\nQIW12Ng++y6iMrwn49YoJOGRhowGVeOsqxU6VKCc/GasHPpKiFmVrTP+tmgq\nB+x8sXnwcn/wQrd1QAkCtjJLnNFAc3KnaxuKW9jwDU20UEr1A5YL/lqz7PWx\nwBfjE/HiduZd81KiByfIPbW0oqp4+Ea5i8gPWLKLFoVKFjo9hmmos9EEcOJl\nc6sq\r\n=p8Af\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHsmTG5O67A13PxzBvbHubVq+dcHO1TMR/C7lUlHlFGMAiEAtyOeTNEDaFJLtPEpgr/0bK9uGUsSklwCqw/dM/e7r6Q="}]},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/worker-threads-pool_1.0.0_1529857664656_0.6681186382465096"},"_hasShrinkwrap":false},"2.0.0":{"name":"worker-threads-pool","version":"2.0.0","description":"Easily manage a pool of Node.js Worker Threads","main":"index.js","directories":{"test":"test"},"dependencies":{"after-all":"^2.0.2"},"devDependencies":{"standard":"^11.0.1","tape":"^4.9.1"},"scripts":{"test":"standard && node --experimental-worker test/test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/worker-threads-pool.git"},"engines":{"node":">=10.5.0"},"keywords":["pool","worker","workers","thread","threads","worker_threads","parallel"],"author":{"name":"Thomas Watson","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/worker-threads-pool/issues"},"homepage":"https://github.com/watson/worker-threads-pool#readme","coordinates":[55.777628,12.590195],"gitHead":"8ccc72dd0b9dcb2748f6bf2c611aa9f3d8b6bba2","_id":"worker-threads-pool@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-5dtGbEucee6o5/kQgpyKIUoHGWf8488DP3ihZDJzDIVvH4V+NA6HdBl/I5ckI4yN1NwM68pdZDbrwac1M95mEA==","shasum":"79db6757fb6c2c2aae106ba23fad1823ae3a8033","tarball":"https://registry.npmjs.org/worker-threads-pool/-/worker-threads-pool-2.0.0.tgz","fileCount":4,"unpackedSize":6203,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbw43WCRA9TVsSAnZWagAARGEP/Rr/t+aLTWpoXDA+nh2O\nav8umOgas23ZWYWsYPEFqICP18mnXl3LwD5g3lggE7GHcytyFrYDN9vPOnO/\nMcUAi7G8B9PfUd1fT7kqO6YBXYbuowWgMcP0wFD1chRJxJDuZg7Xk1WlU2b5\n+ZMrKIL1Q3lal2G5b08vZFDcjwYYvYktq6AiC6NTqTZ28tWIt9wIwqR1jRd/\nupm5y+esEmmM0Ep7GBVBuqkfLkpllZMUwI2lEfmNVDCeOLhYcU7erT//PW1K\nwjcbMBb1x8BOJ5ROjjGfzw2D4dO7H+M1OGflXQVg/OrLxFn2OcyclvsGCBvx\ni/X6jSqU8JldWrKvmh0m4daBUSxzRulVKqvcRFxZAzSQGV+o7qXD2bGxuyBf\nSUFaABeKOR0ZPJrfYFsJjZGjfj4k9XhMRzVplWgOjpE34mFweGIQ0/PfUXSi\n3+UXZFUVxhp4/VVsuG/Ft+e4nyPhzzdosx/CYCXjPHpZ+fb4F9vu5zErrUsR\nt0/d6mctFE26UTlxTtSOe/Hhev3sGiJXBdo9Coh5dahQDCyVMH0VPhIpMv61\npwY6g687HEzoqas7fLYOzrw5QpVqFfIGvJktXVlT2KGZDEoXcXAwww15sYQy\n4o8XiZQ0WoFOGqCQlWPOqM4atqDmlzZ3i2JOAn1kxBvjFbGJzqvWwMcZMC5l\nnCZv\r\n=RBf3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGqgiAqHfJt1gq1Xp0iKAEqBwJVYM4g3tivG0x8A4leKAiAKccta+8+Kgn6pJBjWyJD6IiLP3n53b+pDTKbwu7Z0Ow=="}]},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/worker-threads-pool_2.0.0_1539542485408_0.2169961680531145"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-24T16:27:44.655Z","1.0.0":"2018-06-24T16:27:44.716Z","modified":"2022-05-24T16:45:13.141Z","2.0.0":"2018-10-14T18:41:25.526Z"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"description":"Easily manage a pool of Node.js Worker Threads","homepage":"https://github.com/watson/worker-threads-pool#readme","keywords":["pool","worker","workers","thread","threads","worker_threads","parallel"],"repository":{"type":"git","url":"git+https://github.com/watson/worker-threads-pool.git"},"author":{"name":"Thomas Watson","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"bugs":{"url":"https://github.com/watson/worker-threads-pool/issues"},"license":"MIT","readme":"# worker-threads-pool\n\nEasily manage a pool of [Node.js Worker\nThreads](https://nodejs.org/api/worker_threads.html).\n\n[![npm](https://nodei.co/npm/worker-threads-pool.png)](https://www.npmjs.com/package/worker-threads-pool)\n\n[![Build status](https://travis-ci.org/watson/worker-threads-pool.svg?branch=master)](https://travis-ci.org/watson/worker-threads-pool)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n## Installation\n\n```\nnpm install worker-threads-pool --save\n```\n\n## Prerequisites\n\nWorker Threads in Node.js are still an experimental feature and is only\nsupported in Node.js v10.5.0 and above. To use Worker Threads, you need\nto run `node` with the `--experimental-worker` flag:\n\n```\nnode --experimental-worker app.js\n```\n\n## Usage\n\n```js\nconst Pool = require('worker-threads-pool')\n\nconst pool = new Pool({max: 5})\n\nfor (let i = 0; i < 100; i++) {\n  pool.acquire('/my/worker.js', function (err, worker) {\n    if (err) throw err\n    console.log(`started worker ${i} (pool size: ${pool.size})`)\n    worker.on('exit', function () {\n      console.log(`worker ${i} exited (pool size: ${pool.size})`)\n    })\n  })\n}\n```\n\n## API\n\n### `pool = new Pool([options])`\n\n`options` is an optional object/dictionary with the any of the following properties:\n\n- `max` - Maximum number of workers allowed in the pool. Other workers\n  will be queued and started once there's room in the pool (default:\n  `1`)\n- `maxWaiting` - Maximum number of workers waiting to be started when\n  the pool is full. The callback to `pool.acquire` will be called with\n  an error in case this limit is reached\n\n### `pool.size`\n\nNumber of active workers in the pool.\n\n### `pool.acquire(filename[, options], callback)`\n\nThe `filename` and `options` arguments are passed directly to [`new\nWorker(filename,\noptions)`](https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options).\n\nThe `callback` argument will be called with the an optional error object\nand the worker once it's created.\n\n### `pool.destroy([callback])`\n\nCalls\n[`worker.terminate()`](https://nodejs.org/api/worker_threads.html#worker_threads_worker_terminate_callback)\non all workers in the pool.\n\nWill call the optional `callback` once all workers have terminated.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}