Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/terminal > TerminalTransform

TerminalTransform class

The abstract base class for TerminalWritable objects that receive an input, transform it somehow, and then write the output to another TerminalWritable.

Signature:

export declare abstract class TerminalTransform extends TerminalWritable 

Extends: TerminalWritable

Remarks

The TerminalTransform and SplitterTransform base classes formalize the idea of modeling data flow as a directed acyclic graph of reusable transforms, whose final outputs are TerminalWritable objects.

The design is based loosely on the WritableStream and TransformStream classes from the system Streams API, except that instead of asynchronous byte streams, the TerminalWritable system synchronously transmits human readable messages intended to be rendered on a text console or log file.

The main feature of the TerminalTransform class is its TerminalTransform.destination property, which tracks the next link in the graph.

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the TerminalTransform class

Properties

PropertyModifiersTypeDescription
destinationreadonlyTerminalWritableThe target TerminalWritable that the TerminalTransform will write its output to.
preventDestinationAutoclosereadonlybooleanPrevents the TerminalTransform.destination object from being closed automatically when the transform is closed.

Methods

MethodModifiersDescription
autocloseDestination()protectedThe default implementation of TerminalTransform.onClose() calls this method, which closes the TerminalTransform.destination if appropriate.
onClose()protected