JavaScripture
Contribute via GitHub
Feedback
TransformStream
Constructors
Instance Properties
readable
writable
Streams API
All API
No API set selected.
TransformStream
:
Object
constructor
Spec
Constructors
new
TransformStream
(
[
transformer
:
Transformer
,
[
writableStrategy
:
QueuingStrategy
,
[
readableStrategy
:
QueuingStrategy
]
]
]
) :
TransformStream
Example:
const reader = new ReadableStream({ start(controller) { ['a', 'b', 'c'].forEach(s => controller.enqueue(s)); controller.close(); } }).pipeThrough(new TransformStream({ transform(chunk, controller) { controller.enqueue(chunk.toUpperCase()); } })).getReader(); let result; while (!(result = await reader.read()).done) { console.log(result.value); }
Run
Results:
Instance Properties
readable
:
ReadableStream
readonly
writable
:
ReadableStream
readonly
home
license
contribute
feedback
toggle light/dark mode
Copyright © JavaScripture Contributors