git-command-helper
Version:
github command helper for nodejs
24 lines (20 loc) • 531 B
JavaScript
// git-command-helper 2.1.0 by Dimas Lanjaka <dimaslanjaka@gmail.com> (https://www.webmanajemen.com)
;
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;