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

Constructor Modifiers Description
(constructor)(options)   Constructs a new instance of the TerminalTransform class

Properties

Property Modifiers Type Description
destination   TerminalWritable The target TerminalWritable that the TerminalTransform will write its output to.
preventDestinationAutoclose   boolean Prevents the TerminalTransform.destination object from being closed automatically when the transform is closed.

Methods

Method Modifiers Description
autocloseDestination()   The default implementation of TerminalTransform.onClose() calls this method, which closes the TerminalTransform.destination if appropriate.
onClose()