{"_id":"web-stream-map","_rev":"1-0b6e0160c3ef4931cec1007aec057c24","name":"web-stream-map","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"web-stream-map","version":"1.0.0","author":"","license":"MIT","_id":"web-stream-map@1.0.0","maintainers":[{"name":"trevorah","email":"andy@trevorah.net"}],"homepage":"https://github.com/trevorah/web-stream-map#readme","bugs":{"url":"https://github.com/trevorah/web-stream-map/issues"},"dist":{"shasum":"c29061392f6f86ca46ae2ab667ecbd31391585b8","tarball":"https://registry.npmjs.org/web-stream-map/-/web-stream-map-1.0.0.tgz","fileCount":6,"integrity":"sha512-2X+kqHJDTlJxkvxwPUkmnsfSqFbpHzaAbiETOnHAPAD15kHhIYFt9surF9MPHC2fNSVzirP+hQd+00yGckLFVw==","signatures":[{"sig":"MEUCIQCCtcj7cqV73dMvIGX1cjhUopzS71ulLmMPOUeQR5vqHAIgfjdLPUuAeLmk3uteI097QPEexBzkFD6NLkP3h7uOV0U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3450},"main":"index.js","type":"module","types":"./index.d.ts","exports":{"types":"./index.d.ts","default":"./index.js"},"gitHead":"8278588326b62c70dc711902f20b6d75ddbf3f8a","scripts":{"test":"node --test"},"_npmUser":{"name":"trevorah","email":"andy@trevorah.net"},"repository":{"url":"git+https://github.com/trevorah/web-stream-map.git","type":"git"},"_npmVersion":"11.0.0","description":"","directories":{},"_nodeVersion":"22.11.0","dependencies":{"p-limit":"^6.2.0","s-compose":"^1.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/web-stream-map_1.0.0_1737924419856_0.23275601320114414","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"web-stream-map","version":"1.0.1","description":"A map function for Web Streams with concurrency support. Like node's ReadableStream.map(), but for Web Streams.","keywords":["web streams","streams","map","concurrency","async","TransformStream"],"homepage":"https://github.com/trevorah/web-stream-map#readme","bugs":{"url":"https://github.com/trevorah/web-stream-map/issues"},"repository":{"type":"git","url":"git+https://github.com/trevorah/web-stream-map.git"},"license":"MIT","author":{"name":"Andy Trevorah","email":"andy@trevorah.net"},"type":"module","main":"index.js","exports":{"types":"./index.d.ts","default":"./index.js"},"scripts":{"test":"node --test"},"dependencies":{"p-limit":"^6.2.0","s-compose":"^1.0.0"},"_id":"web-stream-map@1.0.1","gitHead":"5dc3c62f186a5db77cf093ac66734f634fecab55","types":"./index.d.ts","_nodeVersion":"22.11.0","_npmVersion":"11.0.0","dist":{"integrity":"sha512-qDLe4bpu5LFxu/BFlASqHzNuzS3zKldaUGIBbg9f8ty+OePSNDreVRr4EgxgZTJ1W6sAsjUq7oG5y3oHVF0HvQ==","shasum":"3ab0958f0fe57cdba9d5d658edc379f5bdf6fdb1","tarball":"https://registry.npmjs.org/web-stream-map/-/web-stream-map-1.0.1.tgz","fileCount":6,"unpackedSize":4934,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICVrTEgk3hq7KMIWQO7jSAgyAhlcbaTeHOlHHleUQOt4AiAIh5VLTDJohY7pCpQb+c4RH4trtW7c9bmsTFi8YgMw6Q=="}]},"_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/web-stream-map_1.0.1_1737925463837_0.6422951288526562"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-26T20:46:59.855Z","modified":"2025-01-26T21:04:24.220Z","1.0.0":"2025-01-26T20:47:00.073Z","1.0.1":"2025-01-26T21:04:24.030Z"},"bugs":{"url":"https://github.com/trevorah/web-stream-map/issues"},"license":"MIT","homepage":"https://github.com/trevorah/web-stream-map#readme","repository":{"type":"git","url":"git+https://github.com/trevorah/web-stream-map.git"},"maintainers":[{"name":"trevorah","email":"andy@trevorah.net"}],"readme":"# web-stream-map\n\nA map function for Web Streams with concurrency support. Like node's ReadableStream.map(), but for Web Streams. Works in browsers and Node.js.\n\n## Installation\n\n```bash\nnpm install web-stream-map\n```\n\n## Usage\n\nsMap creates a `TransformStream` that can be pipeThrough()'d into a stream.\n\n### Basic\n\n```js\nimport sMap from \"web-stream-map\";\n\nconst stream = ReadableStream.from([1, 2, 3]);\nconst result = await Array.fromAsync(\n  stream.pipeThrough(sMap((chunk) => chunk * 2))\n);\nconsole.log(result); // [2, 4, 6]\n```\n\n### Concurrency\n\n```js\nimport sMap from \"web-stream-map\";\nimport { setTimeout } from \"node:timers/promises\";\n\nconst stream = ReadableStream.from([1, 2, 3]);\nconst result = await Array.fromAsync(\n  stream.pipeThrough(\n    sMap(\n      async (chunk) => {\n        await setTimeout(100);\n        return chunk * 2;\n      },\n      { concurrency: 5 }\n    )\n  )\n);\n\nconsole.log(result); // [2, 4, 6], but in 100ms\n```\n\n## API\n\n### sMap(fn, options)\n\n- `fn` - A function that takes a chunk and returns a promise or value.\n- `options` - An optional object with a `concurrency` property. Defaults to 1.\n\nReturns a `TransformStream` that maps over the input stream and applies the function to each chunk.\n","readmeFilename":"README.md","description":"A map function for Web Streams with concurrency support. Like node's ReadableStream.map(), but for Web Streams.","keywords":["web streams","streams","map","concurrency","async","TransformStream"],"author":{"name":"Andy Trevorah","email":"andy@trevorah.net"}}