UNPKG

git-command-helper

Version:
24 lines (20 loc) 531 B
// git-command-helper 2.1.0 by Dimas Lanjaka <dimaslanjaka@gmail.com> (https://www.webmanajemen.com) 'use strict'; var stream = require('stream'); class CacheStream extends stream.Transform { _cache; constructor() { super(); this._cache = []; } _transform(chunk, enc, callback) { const buf = chunk instanceof Buffer ? chunk : Buffer.from(chunk, enc); this._cache.push(buf); this.push(buf); callback(); } getCache() { return Buffer.concat(this._cache); } } module.exports = CacheStream;