Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Created October 26, 2024 17:32
Show Gist options
  • Save kettanaito/9c47952c5bfd3314b895178a0d33b37c to your computer and use it in GitHub Desktop.
Save kettanaito/9c47952c5bfd3314b895178a0d33b37c to your computer and use it in GitHub Desktop.
PipelineStream
export class PipelineStream extends TransformStream {
constructor(
transformStreams: Array<TransformStream>,
...strategies: Array<QueuingStrategy>
) {
super({}, ...strategies)
const readable = [super.readable as any, ...transformStreams].reduce(
(readable, transform) => readable.pipeThrough(transform)
)
Object.defineProperty(this, 'readable', {
get() {
return readable
},
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment