Processes a ReadableStream with a callback function and optional context.
Similar to consumeStream but doesn't collect results - just processes each chunk sequentially. Useful for side effects like logging, writing to files, etc.
Stream element type
Context type passed to callback
The ReadableStream to process
Callback function applied to each chunk (receives chunk and context)
Optional context object passed to each callback invocation
Promise that resolves when stream is fully processed
await processStream(logStream, (entry, ctx) => { ctx.count++; console.log(`[${ctx.count}]`, entry);}, { count: 0 }); Copy
await processStream(logStream, (entry, ctx) => { ctx.count++; console.log(`[${ctx.count}]`, entry);}, { count: 0 });
Processes a ReadableStream with a callback function and optional context.
Similar to consumeStream but doesn't collect results - just processes each chunk sequentially. Useful for side effects like logging, writing to files, etc.