UNPKG

transgate

Version:

Agent-based task flow framework

25 lines (24 loc) 719 B
/// <reference types="node" /> import { Readable } from 'stream'; import { InGate } from './type'; /** * Readline stream Gate for Input */ export declare abstract class ReadLineStreamGate<T> implements InGate<T> { private _buffer; /** * @param {stream.Readable} readStream - readable stream */ constructor(readStream: Readable); /** * @return {Promise<object>} - A promise that resolves the item when a line can be read */ receive(): Promise<T | null>; /** * Convert string to item. * Sub-class should override * @param {string} data - a line from stdin * @return {object} item returned to the receiver */ abstract _parse(data: string): T; }