{"_id":"@ronomon/queue","_rev":"5-075d53b9675fa2ca748f133f1e0c3ebc","name":"@ronomon/queue","description":"Process thousands of asynchronous or synchronous jobs, concurrently or sequentially, safely and efficiently, without creating thousands of closures.","dist-tags":{"latest":"3.0.1"},"versions":{"2.1.0":{"name":"@ronomon/queue","version":"2.1.0","description":"Process thousands of asynchronous or synchronous jobs, concurrently or sequentially, safely and efficiently, without creating thousands of closures.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ronomon/queue.git"},"keywords":["abort","array","async","asynchronous","callback","cb","closure","concurrency","concurrent","control","control flow","each","error","flow","flow control","foreach","iterate","loop","map","parallel","queue","sequential","serial","series","stop","stream","sync","synchronous","terminate","throttle","utility"],"author":{"name":"Joran Dirk Greef"},"license":"MIT","bugs":{"url":"https://github.com/ronomon/queue/issues"},"homepage":"https://github.com/ronomon/queue#readme","scripts":{"test":"node test.js"},"gitHead":"46a69eba8b17a05f7722cf64c785cb3c2c5c721d","_id":"@ronomon/queue@2.1.0","_shasum":"3a6624f97532b682999907adb703c655a159df7d","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"ronomon","email":"info@ronomon.com"},"dist":{"shasum":"3a6624f97532b682999907adb703c655a159df7d","tarball":"https://registry.npmjs.org/@ronomon/queue/-/queue-2.1.0.tgz","integrity":"sha512-q+tTAKg5XX5Zxycs/zIA5wXDHoaeLQN8rBa79gZgVBPkaY0JJE8sszbfXgzlbaIkOBDf179JH7QS4S3VfPdcWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDT6XYnMF+DYnuedIPXdNJ8k8OuyEJvzFGBq1lqC+MTcwIhALcdyPdu1pxMr57J+I9hT9mGZO5BB9xAWit0uCHo2pon"}]},"maintainers":[{"name":"ronomon","email":"info@ronomon.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/queue-2.1.0.tgz_1490004421602_0.26730011217296124"},"directories":{}},"3.0.0":{"name":"@ronomon/queue","version":"3.0.0","description":"Process thousands of asynchronous or synchronous jobs, concurrently or sequentially, safely and efficiently, without creating thousands of closures.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ronomon/queue.git"},"keywords":["abort","array","async","asynchronous","callback","cb","closure","concurrency","concurrent","control","control flow","each","error","flow","flow control","foreach","iterate","loop","map","parallel","queue","sequential","serial","series","stop","stream","sync","synchronous","terminate","throttle","utility"],"author":{"name":"Joran Dirk Greef"},"license":"MIT","bugs":{"url":"https://github.com/ronomon/queue/issues"},"homepage":"https://github.com/ronomon/queue#readme","scripts":{"test":"node test.js"},"gitHead":"345f076c6fc3e3d9bb76cbab9f80285696a3f1ac","_id":"@ronomon/queue@3.0.0","_npmVersion":"5.4.2","_nodeVersion":"8.6.0","_npmUser":{"name":"ronomon","email":"info@ronomon.com"},"dist":{"integrity":"sha512-+Dnc8cNXa0mI1cD+YdA3mmQP8j1CjQKXfILiXgZGWAtauMIUxuhRgnOLgabKjEj+Wa8r2rQKsaNaDayxauImGQ==","shasum":"3dd632ebc87759506af4371ec3ae7f1964ee89e5","tarball":"https://registry.npmjs.org/@ronomon/queue/-/queue-3.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDMm3DVgiPpabFZmB8WLD7M4qETr2OJSmSOgWBHCrC0mAiEAwbnLlZlY5sPPcVUKhbl6ZBqUlD20Nvrlwf65KFcbokM="}]},"maintainers":[{"name":"ronomon","email":"info@ronomon.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/queue-3.0.0.tgz_1509099329640_0.4476012550294399"},"directories":{}},"3.0.1":{"name":"@ronomon/queue","version":"3.0.1","description":"Process thousands of asynchronous or synchronous jobs, concurrently or sequentially, safely and efficiently, without creating thousands of closures.","main":"index.js","repository":{"type":"git","url":"git+https://github.com/ronomon/queue.git"},"keywords":["abort","array","async","asynchronous","callback","cb","closure","concurrency","concurrent","control","control flow","each","error","flow","flow control","foreach","iterate","loop","map","parallel","queue","sequential","serial","series","stop","stream","sync","synchronous","terminate","throttle","utility"],"author":{"name":"Joran Dirk Greef"},"license":"MIT","bugs":{"url":"https://github.com/ronomon/queue/issues"},"homepage":"https://github.com/ronomon/queue#readme","scripts":{"test":"node test.js"},"gitHead":"0c2ffbe7351ec497102b14bf504ba05267962d65","_id":"@ronomon/queue@3.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.8.0","_npmUser":{"name":"ronomon","email":"info@ronomon.com"},"dist":{"integrity":"sha512-STcqSvk+c7ArMrZgYxhM92p6O6F7t0SUbGr+zm8s9fJple5EdJAMwP3dXqgdXeF95xWhBpha5kjEqNAIdI0r4w==","shasum":"42613e8488289ad452f4cf2244064958fc08d370","tarball":"https://registry.npmjs.org/@ronomon/queue/-/queue-3.0.1.tgz","fileCount":6,"unpackedSize":19722,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4WNXCRA9TVsSAnZWagAAHC4P/RMNxrFV44iTnULcCjoJ\n8BimfRRyq/XmKb7eO5QHVTrbmLBNLAsYmFLC53fNqCmIosv4xK7SnJSebjV5\n+/rFgClNbEqcwiigmqgW+wkCzbgEL1dw8OjkxjKu7TEtxvcfWxj9nFJiJ1B4\n4mDb8m++rOCnrrPnL23ETWSZhLDV0QxDEt4a/DV9ERWdeeMVwz4sv0TFzxls\ntj8lQg+qvs94Xo/knXiYB9lkKBsEWJrawVd9RsnCA1W3Hw4RpO83FjtmAcQQ\n5IRg1oHb3iHPueoa6wJqmK7F30w8P0C5fLJy4rZq0D2Y4KE2Ec7LAyaMxXt5\nLzO2FCJQ+IS/4/FzUhgIzBmG1TnmI8h3reZYBKMjPt1d4OnwOHST5wkCVtyq\nMlO8GvxRfvdP7rVzsLIMJCmQyWriShJkOzz4GdkaMC1UoHerLwSmPaM4QWo9\nhNoGdSkZB2MxOrLK0bXxgNqhQDxxhQnRTyeIoyzUz6RWQ9hQVokMjZZmT3dL\nD+1Pfo0E+lpLcNHIZBKia+uKrlXQZ3P9nKrq4o9b3ZVrhoDVFFi1lWVpAfXf\nTtrqNf5fSKPhqjuXymeT7zih1QO0TpYikUN8bfB1yp8aIY6Z8KjuQy+I8aGe\nBRVncaKgOf2TdiM1P2TT9DeJTLKtqmfu8RmW75eJTs1hAZP3olFQfQZUIf/K\nryRb\r\n=enKU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCN6Pp3pPpUhkWXRx5PR8wyQrtBunrXwKTWS3/F6nuoowIhAO//h72uAFIJd+ohwCsQuU9xtaXJzIYcuegDAKb4zAs+"}]},"maintainers":[{"name":"ronomon","email":"info@ronomon.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/queue_3.0.1_1541497687339_0.1674414980075507"},"_hasShrinkwrap":false}},"readme":"# queue\n\nProcess thousands of asynchronous or synchronous jobs, concurrently or\nsequentially, safely and efficiently, without creating thousands of closures.\n\n## Installation\n\n`@ronomon/queue` has no dependencies.\n\n```\nnpm install @ronomon/queue\n```\n\n## Usage\n\n**var queue = new Queue([concurrency])**\n\n* `concurrency` An integer >= 1, the maximum number of jobs to run concurrently. **Default: `1`**\n\nExample:\n\n```javascript\nvar Queue = require('@ronomon/queue');\n\nvar queue = new Queue(4);\nqueue.onData = function(integer, end) {\n  console.log('Processing ' + integer + '...');\n  // Notify the queue that we are done processing job:\n  end();\n};\nqueue.onEnd = function(error) {\n  if (error) throw error;\n  console.log('Done');\n};\nqueue.push(1);\nqueue.push(2);\nqueue.push(3);\nqueue.push(4);\nqueue.push(5);\nqueue.push(6);\nqueue.push(7);\nqueue.push(8);\nqueue.push(9);\nqueue.push(10);\n// Notify the queue that we are done pushing jobs:\nqueue.end();\n```\n\n**queue.onData = function(job, end) { end() }**\n\n* `job` A job which was pushed individually or pushed as part of an `Array` of\njobs.\n* `end` A callback for `onData()` to call when `onData()` has finished\nprocessing `job`.\n\nA function which must be provided and which will be called once for each job. If\nan error is encountered while processing the job, this can be passed to the\n`end` callback to stop the queue and return an error to the `onEnd()` function.\n\n**queue.onEnd = function([error]) {}**\n\n* `error` An error encountered (if any) while pushing jobs onto the queue, or\nwhile processing jobs in the queue.\n\nA function which must be provided and which will be called once `queue.end()`\nhas been called and once all running and pending jobs in the queue complete. If\nan error is encountered, then `onEnd(error)` will be called as soon as all\nrunning jobs complete. If the queue is stopped using `stop()`, then `onEnd()`\nwill be called as soon as all running jobs complete.\n\n**queue.push(job)**\n\n* `job` Any object, will be passed to the `onData()` function.\n\n**queue.concat(jobs)**\n\n* `jobs` An Array of jobs, each of which will be passed to the `onData()`\nfunction.\n\n**queue.end()**\n\nNotify the queue that no further jobs will be pushed. The queue will wait for\nall running and all pending jobs to complete, and will then call the `onEnd()`\nfunction. `queue.end()` is idempotent, successive calls will be ignored.\n\n**queue.end(error)**\n\n* `error` An error encountered while pushing jobs onto the queue.\n\nNotify the queue that no further jobs will be pushed because an error was\nencountered while pushing jobs onto the queue. The queue will ignore any pending\njobs, will wait for all running jobs to complete, and will then call the\n`onEnd()` function. The `onEnd()` function will be called with the same `error`,\nif no jobs return a different `error` before `queue.end(error)` is called. `queue.end(error)` is idempotent, successive calls will be ignored.\n\n**queue.stop([error])**\n\n* `error` An error encountered while pushing jobs onto the queue, or while\nprocessing jobs in the queue.\n\nAn optional method to notify the queue that any pending jobs should be ignored.\nThe queue will ignore any pending jobs, will wait for all running jobs to\ncomplete, and will then call the `onEnd()` function. If no `error` argument is\nprovided, then the `onEnd()` function will be called without an `error`,\nprovided no jobs return an `error` before `stop()` is called (if any running\n  jobs return an `error` after `stop()` is called, their errors will be\n  ignored). `stop()` is idempotent, successive calls will be ignored.\n\nThere are several differences between `stop()` and `queue.end()`. `stop()` will\nignore any pending jobs, whereas `queue.end()` will wait for all pending jobs to\ncomplete before calling the `onEnd()` function. A successive call to\n`queue.end(error)` will be ignored if `queue.end()` has already been called,\nwhereas `stop(error)` will stop the queue even if `queue.end()` has already been\ncalled.\n\n## Tests\n\n`@ronomon/queue` ships with a long-running fuzz test:\n\n```\nnode test.js\n```\n\n## Benchmark\n\nTo benchmark the cost of the queue implementation:\n\n```\nnode benchmark.js\n```\n","maintainers":[{"name":"ronomon","email":"info@ronomon.com"}],"time":{"modified":"2022-06-12T23:16:09.789Z","created":"2017-03-20T10:07:02.630Z","2.1.0":"2017-03-20T10:07:02.630Z","3.0.0":"2017-10-27T10:15:29.702Z","3.0.1":"2018-11-06T09:48:07.478Z"},"homepage":"https://github.com/ronomon/queue#readme","keywords":["abort","array","async","asynchronous","callback","cb","closure","concurrency","concurrent","control","control flow","each","error","flow","flow control","foreach","iterate","loop","map","parallel","queue","sequential","serial","series","stop","stream","sync","synchronous","terminate","throttle","utility"],"repository":{"type":"git","url":"git+https://github.com/ronomon/queue.git"},"author":{"name":"Joran Dirk Greef"},"bugs":{"url":"https://github.com/ronomon/queue/issues"},"license":"MIT","readmeFilename":"README.md"}