{"name":"easy-transform-stream","version":"0.1.0","description":"Create a transform stream using await instead of callbacks","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/easy-transform-stream.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["stream","transform","async","function","await","through"],"devDependencies":{"ava":"^4.0.1","delay":"^5.0.0","get-stream":"^6.0.1","tsd":"^0.19.1","xo":"^0.47.0"},"types":"./index.d.ts","gitHead":"ea4ec8834ff6ba12208ac7f3a05396a8e9978306","bugs":{"url":"https://github.com/sindresorhus/easy-transform-stream/issues"},"homepage":"https://github.com/sindresorhus/easy-transform-stream#readme","_id":"easy-transform-stream@0.1.0","_nodeVersion":"12.22.1","_npmVersion":"8.3.2","dist":{"integrity":"sha512-H+OgVhCa0gJJ3QA2MlMy3abnqLKkcfoLYkEunJUTsIyChPZEZyICAPo6a/pbKA/2vUz99F2oc5b8kVZwOh3a7A==","shasum":"11fb310a4645d73fa2357c58f4744dfb03281867","tarball":"http://registry-npm.ywwl.com/easy-transform-stream/download/easy-transform-stream-0.1.0.tgz","fileCount":5,"unpackedSize":5177,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh7n1HCRA9TVsSAnZWagAA0CsP/2PUMgffMXN2qcM/dUw8\naqvWYlg9Vki1qLaUbNUT5b5sbumGdTdUZmzmiMNHLnTwlSW33zvxHdJWt69e\nbHme3VsVYvq3JjBXoGTxQWJTG9myQlkUmFJcyzaTZA+xqZnpKJbP0FPWEjM5\n/Nv6UOU4eCF19K/W5b+S+Cnx9uRyLIR6AnjO29rLQRsM4AdBhoqDcKrzWbLv\nIL62k0HUoq5+DkfnQYXsMabbhdMz7Fr9ZD/4NLPi5k5kk+Ds3KVtH6hbt8Ec\nZTwhc5gkYyXU2K1BJkg8+9YUwqFIUs5t4ML5zuO4fJR1UKvwRDB3Idws05bc\nloaiwO3CWmwqzgss51Kbj8iTI09rxNd2y69RYdZnq7rP0DfQR6Cpdcqmsoe5\nIBneCQaKIlTyISXBlJeVVyC2LfxrriGJqDTudEm4JlbRSRusREfCjIHEZkc+\n1uF5Bg7+6AuBg/nmthXWj417df7TclrNnlwZcSgi6laMfdttxgiffY5Ba7v7\nLM0u9siBLu3PS1OolvxRxIuPwXXfO/FdvdDu+siFc+hBh4w2FWhSAxGDaICi\nZABQwURif0Au14y0uW6eFh1OD4x+SDkrZlNlLK3EkmzB31kQY1xlAIhIikax\nVfgsKJlVpGl2SZ7cSZeFLcCZVmu+fLd+8FduMxtnIPAszxbaclVaEY0xJofz\nGkix\r\n=MZcz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDq+A2IvQwvVyw0TTUEReMlebx8YljNP07XInDDYWv8pAIhAN4yPMoIK2D3tzIOZyAvt5umoJ1KBGiOFPKorpXEJcI7"}],"size":2268,"noattachment":false,"key":"/easy-transform-stream/-/easy-transform-stream-0.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/easy-transform-stream_0.1.0_1643019590840_0.3055872480587023"},"_hasShrinkwrap":false,"readme":"# easy-transform-stream\n\n> Create a transform stream using await instead of callbacks\n\nThe built-in [`stream.Transform` constructor](https://nodejs.org/api/stream.html#class-streamtransform) forces you to deal with a callback interface. It's much nicer to just be able to await and return a value.\n\nThis package can be thought of as a modern version of [`through2`](https://github.com/rvagg/through2).\n\n## Install\n\n```sh\nnpm install easy-transform-stream\n```\n\n## Usage\n\n```js\nimport transformStream from 'easy-transform-stream';\n\nconst stream = transformStream(async chunk => {\n\tconst newChunk = await modifyChunk(chunk);\n\treturn newChunk;\n});\n```\n\n## API\n\n### easyTransformStream(transformer, flusher?)\n### easyTransformStream(options, transformer, flusher?)\n\n#### transformer(chunk, encoding, stream)\n\nType: Async function\n\nReceives each chunk and is expected to return a transformed chunk.\n\n#### flusher(stream)\n\nType: Async generator function\n\nYield additional chunks at the end of the stream.\n\n#### options\n\nType: `object`\n\nSame as the [options for `stream.Transform`](https://nodejs.org/api/stream.html#new-streamtransformoptions), except for `transform` and `flush`.\n\n## Related\n\n- [get-stream](https://github.com/sindresorhus/get-stream) - Get a stream as a string, buffer, or array\n","publish_time":1643019591061,"_cnpm_publish_time":1643019591061,"dist-tags":{"latest":"1.0.1"}}