Skip to main content
The Deno 2 Release Candidate is here
Learn more
interface ShutdownAwareTransformer
import { type ShutdownAwareTransformer } from "https://deno.land/x/shutdown_aware_transform_stream@1.0.0/mod.ts";

An object that defines the behaviour of a ShutdownAwareTransformStream.

It behaves in the same way as a normal TransformStream Transformer, except that it can have a close() method, and the Controller received by its methods is a ShutdownAwareTransformStreamController.

Type Parameters

optional
I = unknown
optional
O = unknown

Properties

optional
readableType: never
optional
writableType: never
optional
start: (controller: ShutdownAwareTransformStreamController<O>) => void | PromiseLike<void>

Called when the stream is created, before any other Transformer methods.

optional
flush: (controller: ShutdownAwareTransformStreamController<O>) => void | PromiseLike<void>

Called after the final chunk has been processed by transform().

optional
transform: (chunk: I, controller: ShutdownAwareTransformStreamController<O>) => void | PromiseLike<void>

Called with each chunk passing through the stream.

optional
close: () => void

Called when the stream has shutdown, either due to an error or end-of-input.

Never called more than once, even if an error occurs as the stream closes from end-of-input. To distinguish between end-of-input and stream errors, controller.signal.aborted will be true when an error occured, and controller.signal.reason will be the error.