The TransformStream interface of the Streams API represents a concrete implementation of the pipe chain transform stream concept.
It may be passed to the ReadableStream.pipeThrough() method in order to transform a stream of data from one format into another. For example, it might be used to decode (or encode) video frames, decompress data, or convert the stream from XML to JSON.
A transformation algorithm may be provided as an optional argument to the object constructor. If not supplied, data is not modified when piped through the stream.
TransformStream is a transferable object.
ConstructorSection titled Constructor
TransformStream() Creates and returns a transform stream object, optionally specifying a transformation object and queuing strategies for the streams.
Instance propertiesSection titled Instance properties
TransformStream.readable The readable end of a TransformStream.
TransformStream.writable The writable end of a TransformStream.
ExamplesSection titled Examples
Anything-to-uint8array streamSection titled Anything-to-uint8array stream
In the following example, a transform stream passes through all chunks it receives as Uint8Array values.
For more information on TransformStream visit MDN Web Docs.