ansi-stream
Converts a text stream to a stream of strings and EscapeCode
objects
Usage
var ansiStream = ; var EscapeCode = ansiStreamEscapeCode; stream = ; stream; stream; assert; assert; assert;
API
ansiStream(maxBuffer)
Creates a new stream instance, with an optional buffer size.
maxBuffer
Optional
Type: number
Handles the (rare) case where an escape code sequence might span two chunks.
If it does not detect a complete escape code in the chunk, but there is a
control character (\u001b
, or \u009b
), it will buffer up to maxBuffer
characters
until the next chunk.
If you are sure that your input will NOT split escape code sequences across chunks, you can set this to zero for improved performance.
ansiStream.EscapeCode
Can be used by streams further down the chain to discover if a given chunk is an EscapeCode or not. See escape-code for more details.
stream;
License
MIT © James Talmage