UNPKG

@rawcmd/core

Version:
34 lines 891 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const text_1 = require("@rawcmd/text"); const utils_1 = require("@rawcmd/utils"); class MemoryStreamlet { constructor(width = 0, height = 0) { this._buffer = ''; this._width = width; this._height = height; } get width() { return this._width; } get height() { return this._height; } write(chunk) { this._buffer += (utils_1.toString(chunk) || '').replace(/\r\n|\n/g, text_1.EOL); return true; } clearLine() { this._buffer = this._buffer.substr(0, this._buffer.lastIndexOf(text_1.EOL) + 1); return true; } drain() { this._buffer = ''; return true; } toString() { return this._buffer; } } exports.MemoryStreamlet = MemoryStreamlet; //# sourceMappingURL=memory.js.map