{"_id":"writable-consumable-stream","_rev":"3147552","name":"writable-consumable-stream","description":"An async stream which can be iterated over using a for-await-of loop.","dist-tags":{"latest":"4.1.0"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"time":{"modified":"2023-11-27T07:20:34.000Z","created":"2019-02-17T22:20:47.835Z","4.1.0":"2023-10-20T16:29:22.157Z","4.0.1":"2023-09-07T13:04:41.745Z","4.0.0":"2023-09-06T19:51:13.382Z","3.0.1":"2022-10-10T07:36:30.097Z","3.0.0":"2022-10-10T06:04:04.744Z","2.0.0":"2020-02-07T17:57:44.328Z","1.1.1":"2019-02-20T23:28:26.725Z","1.1.0":"2019-02-20T22:45:29.271Z","1.0.3":"2019-02-18T00:56:46.818Z","1.0.2":"2019-02-18T00:43:01.829Z","1.0.1":"2019-02-17T23:33:26.066Z","1.0.0":"2019-02-17T22:20:47.835Z"},"users":{},"author":{"name":"Jonathan Gros-Dubois"},"repository":{"type":"git","url":"git+ssh://git@github.com/SocketCluster/writable-consumable-stream.git"},"versions":{"4.1.0":{"name":"writable-consumable-stream","version":"4.1.0","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^10.2.0"},"dependencies":{"consumable-stream":"^3.0.0"},"gitHead":"58332ccda48a5569f187296a3e986ca9dcc42471","_id":"writable-consumable-stream@4.1.0","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"shasum":"e677076f91499159361d7917dce379cad624b344","size":7524,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-4.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-4.1.0.tgz"},"_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/writable-consumable-stream_4.1.0_1697819361932_0.7976693601227707"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-20T16:29:22.157Z","publish_time":1697819362157,"_source_registry_name":"default","_cnpm_publish_time":1697819362157},"4.0.1":{"name":"writable-consumable-stream","version":"4.0.1","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^10.2.0"},"dependencies":{"consumable-stream":"^3.0.0"},"gitHead":"2cf02cc32d84ec1719f9458c975c2454e80cf3fd","_id":"writable-consumable-stream@4.0.1","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"shasum":"5137a6cbc8fabf0963ac2339bb27e047c35fd933","size":7473,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-4.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-4.0.1.tgz"},"_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/writable-consumable-stream_4.0.1_1694091881572_0.5488626084162835"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-07T13:04:41.745Z","publish_time":1694091881745,"_source_registry_name":"default","_cnpm_publish_time":1694091881745},"4.0.0":{"name":"writable-consumable-stream","version":"4.0.0","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^3.0.0"},"gitHead":"00da1a14bacf79781590787c73174d27ed134c54","_id":"writable-consumable-stream@4.0.0","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"shasum":"a728bdb9e5b326658e194a11593c49300836b986","size":7478,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-4.0.0.tgz"},"_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/writable-consumable-stream_4.0.0_1694029873165_0.8865309493381257"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-09-06T19:51:13.382Z","publish_time":1694029873382,"_source_registry_name":"default","_cnpm_publish_time":1694029873382},"3.0.1":{"name":"writable-consumable-stream","version":"3.0.1","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^2.0.0"},"gitHead":"61aba08d09b0a4c044f8541998b033be20c0920a","_id":"writable-consumable-stream@3.0.1","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"shasum":"666c37544d13ca860ef2e9eca38178d12a127beb","size":7452,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-3.0.1.tgz"},"_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/writable-consumable-stream_3.0.1_1665387389919_0.6664465373221051"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-15T16:57:23.481Z","publish_time":1665387390097,"_cnpm_publish_time":1665387390097},"3.0.0":{"name":"writable-consumable-stream","version":"3.0.0","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^2.0.0"},"gitHead":"5e7e1daa3ee8425b79e553b2a74870989972c70f","_id":"writable-consumable-stream@3.0.0","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"shasum":"37b367d2cff00fba80747d4d1e66b59beff7feb2","size":7438,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-3.0.0.tgz"},"_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/writable-consumable-stream_3.0.0_1665381844554_0.4366386063109602"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-15T16:57:23.086Z","publish_time":1665381844744,"_cnpm_publish_time":1665381844744},"2.0.0":{"name":"writable-consumable-stream","version":"2.0.0","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^2.0.0"},"gitHead":"4ee99fc37fedbe861f0686fa2cb77bea94b62a4c","_id":"writable-consumable-stream@2.0.0","_nodeVersion":"11.13.0","_npmVersion":"6.7.0","dist":{"shasum":"102beeea0b20b4862f263dd8688c926a4caa28d3","size":7300,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-2.0.0.tgz"},"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/writable-consumable-stream_2.0.0_1581098264233_0.6291062468282578"},"_hasShrinkwrap":false,"publish_time":1581098264328,"_cnpm_publish_time":1581098264328},"1.1.1":{"name":"writable-consumable-stream","version":"1.1.1","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^1.0.0"},"gitHead":"9fd7f6b07218f2de83f9e15d5378deb58dc24b2a","_id":"writable-consumable-stream@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"shasum":"f6046da5df15debb344dfa3ce3fcddd7f5ddfaff","size":7309,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-1.1.1.tgz"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/writable-consumable-stream_1.1.1_1550705306515_0.7974998407329439"},"_hasShrinkwrap":false,"publish_time":1550705306725,"_cnpm_publish_time":1550705306725},"1.1.0":{"name":"writable-consumable-stream","version":"1.1.0","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^1.0.0"},"gitHead":"3132130bc2e81b9ad2de642e6ec10ec406075452","_id":"writable-consumable-stream@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"shasum":"b01b41442599319d94f97968a7942b1f60de9c37","size":7300,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-1.1.0.tgz"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/writable-consumable-stream_1.1.0_1550702729023_0.7416244185245957"},"_hasShrinkwrap":false,"publish_time":1550702729271,"_cnpm_publish_time":1550702729271},"1.0.3":{"name":"writable-consumable-stream","version":"1.0.3","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^1.0.0"},"gitHead":"5286f1601b7a7c27f9649f8dca0ed7a0c5d8ecc5","_id":"writable-consumable-stream@1.0.3","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"shasum":"3f798fb92ecb8ffcd44af36e859d99eba4a15d77","size":6881,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-1.0.3.tgz"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/writable-consumable-stream_1.0.3_1550451406689_0.06021797092313652"},"_hasShrinkwrap":false,"publish_time":1550451406818,"_cnpm_publish_time":1550451406818},"1.0.2":{"name":"writable-consumable-stream","version":"1.0.2","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^1.0.0"},"gitHead":"431fe41e733ddfe8168788dbb5da8bc9e4fbb10d","_id":"writable-consumable-stream@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"shasum":"aa879af58530f7864fdb1c116a7215a359083e6c","size":6883,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-1.0.2.tgz"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/writable-consumable-stream_1.0.2_1550450581682_0.9971650812376369"},"_hasShrinkwrap":false,"publish_time":1550450581829,"_cnpm_publish_time":1550450581829},"1.0.1":{"name":"writable-consumable-stream","version":"1.0.1","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^1.0.0"},"gitHead":"48b42bded399699af2918a8c782e97d38e34d217","_id":"writable-consumable-stream@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"shasum":"48a7f75b78e8eb868703b3fde4f841bb8941b724","size":6859,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-1.0.1.tgz"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/writable-consumable-stream_1.0.1_1550446405862_0.8881921274369604"},"_hasShrinkwrap":false,"publish_time":1550446406066,"_cnpm_publish_time":1550446406066},"1.0.0":{"name":"writable-consumable-stream","version":"1.0.0","description":"An 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/writable-consumable-stream.git"},"keywords":["async","generator","stream","data","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","devDependencies":{"mocha":"^5.2.0"},"dependencies":{"consumable-stream":"^1.0.0"},"gitHead":"4d5bdebd5b1e8bb556e7df29030fcb56e860315b","_id":"writable-consumable-stream@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"dist":{"shasum":"cbf9e4d25ecf73f66bb88d34a4f7db69a3dbb3c3","size":6831,"noattachment":false,"key":"/writable-consumable-stream/-/writable-consumable-stream-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/writable-consumable-stream/download/writable-consumable-stream-1.0.0.tgz"},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/writable-consumable-stream_1.0.0_1550442047713_0.1656237481263736"},"_hasShrinkwrap":false,"publish_time":1550442047835,"_cnpm_publish_time":1550442047835}},"readme":"# writable-consumable-stream\nAn async stream which can be iterated over using a for-await-of loop and which can be written to.\n\nThe `WritableConsumableStream` class extends the `ConsumableStream` class.  \nSee https://github.com/SocketCluster/consumable-stream\n\n## Installation\n\n```\nnpm install writable-consumable-stream\n```\n\n## Usage\n\n### Require\n\n```js\nconst WritableConsumableStream = require('writable-consumable-stream');\n```\n\n### Consume a stream and write to it asynchronously:\n\n```js\nlet consumableStream = new WritableConsumableStream();\n\nasync function consumeAsyncIterable(asyncIterable) {\n  // Consume iterable data asynchronously.\n  for await (let packet of asyncIterable) {\n    console.log('Packet:', packet);\n  }\n}\nconsumeAsyncIterable(consumableStream);\n\nsetInterval(() => {\n  // Write data to the stream asynchronously,\n  consumableStream.write(`Timestamp: ${Date.now()}`);\n}, 100);\n```\n\n### Consume a stream using a while loop:\n\n```js\nlet consumableStream = new WritableConsumableStream();\n\nasync function consumeAsyncIterable(asyncIterable) {\n  // Consume iterable data asynchronously.\n  // Works in older environments.\n  let asyncIterator = asyncIterable.createConsumer();\n  while (true) {\n    let packet = await asyncIterator.next();\n    if (packet.done) break;\n    console.log('Packet:', packet.value);\n  }\n}\nconsumeAsyncIterable(consumableStream);\n\nsetInterval(() => {\n  // Write data to the stream asynchronously,\n  consumableStream.write(`Timestamp: ${Date.now()}`);\n}, 100);\n```\n\n### Consume a filtered stream using an async generator:\n\n```js\nlet consumableStream = new WritableConsumableStream();\n\n// Creates an async generator which only produces packets which are allowed by the\n// specified filterFunction.\nasync function* createFilteredStreamGenerator(fullStream, filterFunction) {\n  for await (let packet of fullStream) {\n    if (filterFunction(packet)) {\n      yield packet;\n    }\n  }\n}\n\nasync function consumeAsyncIterable(asyncIterable) {\n  // Consume iterable data asynchronously.\n  for await (let packet of asyncIterable) {\n    console.log('Packet:', packet);\n  }\n}\n\n// The filter function will only include strings which end with the number 5.\nfunction filterFn(data) {\n  return /5$/.test(data);\n}\nlet filteredStreamGenerator = createFilteredStreamGenerator(consumableStream, filterFn);\n\nconsumeAsyncIterable(filteredStreamGenerator);\n\nsetInterval(() => {\n  // Write data to the stream asynchronously,\n  consumableStream.write(`Timestamp: ${Date.now()}`);\n}, 100);\n```\n\n### Consume only the next data object which will be written to the stream:\n\n```js\nlet consumableStream = new WritableConsumableStream();\n\n(async () => {\n  let data = await consumableStream.once();\n  console.log(data);\n})();\n\nsetInterval(() => {\n  // Write data to the stream asynchronously,\n  consumableStream.write(`Timestamp: ${Date.now()}`);\n}, 100);\n```\n\nSee `test/` directory for additional examples.\n","_attachments":{},"homepage":"https://github.com/SocketCluster/writable-consumable-stream#readme","bugs":{"url":"https://github.com/SocketCluster/writable-consumable-stream/issues"},"license":"MIT"}