Created
October 26, 2024 17:32
-
-
Save kettanaito/9c47952c5bfd3314b895178a0d33b37c to your computer and use it in GitHub Desktop.
PipelineStream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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