{"_id":"s-compose","_rev":"1-8d216a1c0f33baeb80027de81ace4957","name":"s-compose","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"s-compose","version":"1.0.0","author":"","license":"MIT","_id":"s-compose@1.0.0","maintainers":[{"name":"trevorah","email":"andy@trevorah.net"}],"homepage":"https://github.com/trevorah/s-compose#readme","bugs":{"url":"https://github.com/trevorah/s-compose/issues"},"dist":{"shasum":"614590d68d3bd75bd2fd534447fc48240cd9586a","tarball":"https://registry.npmjs.org/s-compose/-/s-compose-1.0.0.tgz","fileCount":6,"integrity":"sha512-vGLtfGmStK2lpNaQpubF7UeQD7yxP/Wpn/eNX10n1otSwqI9qodrcqyeydQQuixeekFytz99oV2S9NB185ASlA==","signatures":[{"sig":"MEYCIQDzY/ZjmSCZTCXmRzIqmixVJ8XuTczlbKbv97rJ66110wIhAO4esU1DY8T5GCVTYrnuOtb0sTzBKTEveXsJ+FiWWAAC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6126},"main":"index.js","type":"module","types":"./index.d.ts","exports":{"types":"./index.d.ts","default":"./index.js"},"gitHead":"ee787708e13fd90ffcef86ef8633ebb050735770","scripts":{"test":"node --test"},"_npmUser":{"name":"trevorah","email":"andy@trevorah.net"},"repository":{"url":"git+https://github.com/trevorah/s-compose.git","type":"git"},"_npmVersion":"11.0.0","description":"Compose web streams together","directories":{},"_nodeVersion":"22.11.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/s-compose_1.0.0_1737907145207_0.3128631168938203","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"s-compose","version":"1.0.1","description":"Compose web streams together","homepage":"https://github.com/trevorah/s-compose#readme","bugs":{"url":"https://github.com/trevorah/s-compose/issues"},"exports":{"types":"./index.d.ts","default":"./index.js"},"repository":{"type":"git","url":"git+https://github.com/trevorah/s-compose.git"},"license":"MIT","author":"","type":"module","main":"index.js","scripts":{"test":"node --test"},"_id":"s-compose@1.0.1","gitHead":"946182f5d277ed97d02cb13c935cb5da63bb63b2","types":"./index.d.ts","_nodeVersion":"22.11.0","_npmVersion":"11.0.0","dist":{"integrity":"sha512-Mw2B93kL32XsOSk/Ejs9ji7pZxMhEx2pIdNaZ6/9oDN3UukAFWlW4qPDGyD1mqOWEDsONDVoy74fD7O6V/wt7g==","shasum":"dbb865528aec06482718319ffa1d006bb6c9c715","tarball":"https://registry.npmjs.org/s-compose/-/s-compose-1.0.1.tgz","fileCount":6,"unpackedSize":7830,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDa4PTHcGv69gaUciLRjzC4P5nZ13dKL3x4Pwgqb4Hh7AiANfvBWVZeQylslQ4EBSDITVgqE3PEXeMfHg1xyac/y0g=="}]},"_npmUser":{"name":"trevorah","email":"andy@trevorah.net"},"directories":{},"maintainers":[{"name":"trevorah","email":"andy@trevorah.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/s-compose_1.0.1_1738186175383_0.7858297177008833"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-26T15:59:05.205Z","modified":"2025-01-29T21:29:35.739Z","1.0.0":"2025-01-26T15:59:05.403Z","1.0.1":"2025-01-29T21:29:35.580Z"},"bugs":{"url":"https://github.com/trevorah/s-compose/issues"},"license":"MIT","homepage":"https://github.com/trevorah/s-compose#readme","repository":{"type":"git","url":"git+https://github.com/trevorah/s-compose.git"},"description":"Compose web streams together","maintainers":[{"name":"trevorah","email":"andy@trevorah.net"}],"readme":"# s-compose\n\nCompose web streams together\n\n## Installation\n\n```bash\nnpm install s-compose\n```\n\n## Usage\n\n### Compose multiple TransformStreams into a single TransformStream\n\n```js\nimport sCompose from \"s-compose\";\n\n// transform a string by appending \"a\" and then \"b\"\nconst transform = sCompose(\n  new TransformStream({\n    transform(chunk, controller) {\n      controller.enqueue(chunk + \"a\");\n    },\n  }),\n  new TransformStream({\n    transform(chunk, controller) {\n      controller.enqueue(chunk + \"b\");\n    },\n  })\n);\n```\n\n### Prepend a TransformStream to a WritableStream\n\n```js\nimport sCompose from \"s-compose\";\nimport sBatch from \"s-batch\";\n\n// create a writable stream that batches up items and then uploads them to an API in bulk\nconst writable = sCompose(\n  sBatch(100),\n  new WritableStream({\n    async write(chunks) {\n      await api.bulkUpload(chunks);\n    },\n  })\n);\n```\n\n## API\n```ts\nfunction sCompose(...streams: TransformStream): TransformStream\n```\n\n```ts\nfunction sCompose(...streams: TransformStream, sink: WritableStream): WritableStream\n```\n\n```ts\nfunction sCompose(source: ReadableStream, ...streams: TransformStream): ReadableStream\n```\n","readmeFilename":"README.md"}