{"_id":"consumable-stream","_rev":"3-5a50f3c0f8c048706b9c0006d2199164","name":"consumable-stream","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"consumable-stream","version":"1.0.0","description":"A readable async stream which can be iterated over using a for-await-of loop.","main":"index.js","scripts":{"test":"./node_modules/mocha/bin/_mocha --reporter spec --timeout 10000 --slow 10000"},"repository":{"type":"git","url":"git+ssh://git@github.com/SocketCluster/consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"gitHead":"9ba8e2490e544d7bb2a3afcfe6c81656f1f9ecd8","_id":"consumable-stream@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"integrity":"sha512-CwX4ZzpSMWxTG9Q3tNM+UNlevMfWX1hjR033MlKkT8ChfH9R+Rl7YQu7FCeMMv4bRv9yO33p8aYoX0EwdijaUA==","shasum":"5b0862414730834541792532ee4cf98e22a946f6","tarball":"https://registry.npmjs.org/consumable-stream/-/consumable-stream-1.0.0.tgz","fileCount":5,"unpackedSize":7351,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcadwECRA9TVsSAnZWagAAOjMQAINp6ca3tlUBViDLwMGz\nU0+CBUIxEbhk0uEE0KpbMqwGgl5luz0dSIqbjHxD6UMJTyDJwyD1wiNa9qlC\nmsH0Qp04A9NFcg5KNPVAgiqKFMJ2f9H5ax/m3u9LDCYVKJaXX4CFArGs2y/n\ncmHyhjClT+r6kcR8Gpz2foBrj/mz/vX/9t5lbkccb7m54IZ2SgLvw5cMOJxw\n4OvVEsvNo+Fn+Fw3K47ycijSHtLgLMqO2z5D/ougg3FWPtD57nFJ0MrNLe78\nduIYUOd1iR8iUeVxYXQ8K3YTamMD4LbMhmS5mu6raSUDf2iacdBz2sHWIyLV\nYdOHnckREVWnCeR2X9g9UH3wrOrBdtp7/orMu7CEGFlXJSi2o1RDMOrq3vXs\ncNGNS1Bm442qWWRm3YlnPdutkUgo6VobUQCNuR61r/R2S0Ha/zFSzAXfBBBr\nDrtoK2AbDFOrhlkj0t8i/YFeh7R3LdkdlE3J3w1NwTyi/onZCE7Zi8DAlKnY\nX9RpurDWuUiYdxV5e+yzcsx0x6HzbuISRau/GUMqmqcGzqln+ZfzlW4yqVhx\ntPLRlpIsIZtdl7WcslNBpc2D2uhkx253kokk/W3CpDuANWEL8y1tx+6gfiCx\nLuZ2zh26NuhqTZECDZTATZ/ZLwAsJ0itWORmgNRBnXiof95TYCGCwrrmyL4+\njFBF\r\n=fvlS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDTAWR/FFfmqzUOIsvuBVltvBOMvs7QkTJE5pqNc650KgIgeP4xWIVp50D274iilpsF7AYfaVopmOn5fQDSYcOT74o="}]},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/consumable-stream_1.0.0_1550441476000_0.7802629754775294"},"_hasShrinkwrap":false},"2.0.0":{"name":"consumable-stream","version":"2.0.0","description":"A readable async stream which can be iterated over using a for-await-of loop.","main":"index.js","scripts":{"test":"./node_modules/mocha/bin/_mocha --reporter spec --timeout 10000 --slow 10000"},"repository":{"type":"git","url":"git+ssh://git@github.com/SocketCluster/consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"gitHead":"fac77e46e2544bbecd129355faad0b9b8d6a9de4","_id":"consumable-stream@2.0.0","_nodeVersion":"11.13.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-I6WA2JVYXs/68rEvi1ie3rZjP6qusTVFEQkbzR+WC+fY56TpwiGTIDJETsrnlxv5CsnmK69ps6CkYvIbpEEqBA==","shasum":"11d3c7281b747eb9efd31c199b3a8b1711bec654","tarball":"https://registry.npmjs.org/consumable-stream/-/consumable-stream-2.0.0.tgz","fileCount":5,"unpackedSize":7167,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJePaP5CRA9TVsSAnZWagAAYusQAJE7wdzhMTPe6b2cMPVd\n1AOZw4ruzbwmviHAo9DZWu3ZNQ7xA23spo1Kg9Q3hQKAdexAUq/ohhrc0Yy3\npEe2ARDeD4mMqH+cnU1wxoGBDx4qSqJ1kQ9SwDlbtarr0+JresMgNTV8K0hM\nfPeFDpO89/RuXqebcRpZnqn6qIP28IKzsAVynoB1WY3tvBE4bND1hWpaocdl\nb7SO+kDoismXCVJTUDTYDts/ivaKjT4PrkyOOoviASmqvx9aiL1iEAfiwFkn\niBm8z6ufqiT1fLunQ8lK+H4wLAq2thMvJjwrIKCKzlxVNqmJybwYBuwL3pHY\nL5UMkQDi/FsK5+D679NGkjGmZfijHRHrCi8M9CNrp+FeYs+dwPLwFOgpH08o\nlqYiPEwvpa7LvOnawJCCRzLz9xQT3l32qZn8vWBXGxEdZdz5n0gsG3MwAnxQ\nKuZHUH5cMOO79xAC4mhS3K3bjwXT9TifCMVXsmJNc74VGsrZRD2AaqDmRwZV\nnE74+fIakFSideBKthVuAQM7AhGMAeYadyUPqUGwGVvS4cguynvjpOQiq8Mt\n9ksaSSuLJ1Jxk+skTj9U1LYK/Lf2iR42YihSIU9/hC6ItxBnyLM2LwLs9G6u\nrjzj9KDFDjswruhGIttjeTchF/YLrnf3gg4JJoadngva4PpvZws8rRwAIo8a\nUtQC\r\n=TpZF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCV5md5TSDp3keFbRvgxBv4xvFzDSO0kt1Z83LH/9PaSQIhAOnruW3ubQvSz8WLCQzkJOHN8sMJKL25TRiD23+pdcmg"}]},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/consumable-stream_2.0.0_1581097976983_0.09921821712980261"},"_hasShrinkwrap":false},"3.0.0":{"name":"consumable-stream","version":"3.0.0","description":"A readable async stream which can be iterated over using a for-await-of loop.","main":"index.js","scripts":{"test":"./node_modules/mocha/bin/_mocha --reporter spec --timeout 10000 --slow 10000"},"repository":{"type":"git","url":"git+ssh://git@github.com/SocketCluster/consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"gitHead":"1c0efdb43b5bb8bc4ccbdce54d0b749850f04bd1","_id":"consumable-stream@3.0.0","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"integrity":"sha512-CnnsJ9OG9ouxAjt3pc63/DaerezRo/WudqU71pc5epaIUi7NHu2T4v+3f0nKbbCY7icS/TfQ1Satr9rwZ7Jwsg==","shasum":"2bf140e0c5f9b63d6fa116ac6b05e53713d3cb41","tarball":"https://registry.npmjs.org/consumable-stream/-/consumable-stream-3.0.0.tgz","fileCount":5,"unpackedSize":7470,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID2r+XAlXU2sEx7uTiKxfYWY1LLIkur1U2aO7bUIJgC0AiEA6j949YOMFl+j2UWWOj7Zri8Z6fJe6W/Zt/QgRChgDcM="}]},"_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"directories":{},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/consumable-stream_3.0.0_1694029807597_0.4709778061171592"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-17T22:11:15.999Z","1.0.0":"2019-02-17T22:11:16.168Z","modified":"2023-09-06T19:50:07.948Z","2.0.0":"2020-02-07T17:52:57.142Z","3.0.0":"2023-09-06T19:50:07.761Z"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"description":"A readable async stream which can be iterated over using a for-await-of loop.","homepage":"https://github.com/SocketCluster/consumable-stream#readme","keywords":["async","generator","stream","data","for-await-of"],"repository":{"type":"git","url":"git+ssh://git@github.com/SocketCluster/consumable-stream.git"},"author":{"name":"Jonathan Gros-Dubois"},"bugs":{"url":"https://github.com/SocketCluster/consumable-stream/issues"},"license":"MIT","readme":"# consumable-stream\nA readable stream which can be iterated over using a for-await-of loop or using a while loop with await inside.\n\nThe `ConsumableStream` constructor is an abstract class which must be subclassed. Its `next()` and `createConsumer()` methods must be overriden.\n\nFor a concrete subclass of `ConsumableStream`, see `WritableConsumableStream`: https://github.com/SocketCluster/writable-consumable-stream\n\n## Installation\n\n```\nnpm install consumable-stream\n```\n\n## Usage\n\nThe `ConsumableStream` class exposes the following methods:\n\n- `[Symbol.asyncIterator]`: Makes the instance iterable using a for-await-of loop.\n- `next`: Returns a `Promise` which will resolve an object in the form `{value: data, done: boolean}` whenever some data is received or when the stream ends.\n- `once`: Similar to `next()` except that the resolved value will be the raw data and it will not resolve when the stream ends. Note that once `once()` is called, it cannot be cancelled; the affected closure will stay in memory until either `once()` resolves or until the stream is ended or garbage collected.\n\n```js\n// Consume data objects from consumableStream as they are written to the stream.\n(async () => {\n  for await (let data of consumableStream) {\n    console.log(data);\n  }\n})();\n\n// Consume only the next data object which is written to the stream.\n(async () => {\n  let data = await consumableStream.once();\n  console.log(data);\n})();\n```\n","readmeFilename":"README.md"}