tar-iterator
Version:
Extract contents from tar archive type using an iterator API using streams or paths. Use stream interface and pipe transforms to add decompression algorithms
25 lines (24 loc) • 611 B
JavaScript
import BaseIterator from 'extract-base-iterator';
let Lock = class Lock {
retain() {
this.count++;
}
release() {
if (this.count <= 0) throw new Error('Lock count is corrupted');
this.count--;
if (this.count === 0) this.__destroy();
}
__destroy() {
if (this.iterator) {
BaseIterator.prototype.end.call(this.iterator, this.err || null);
this.iterator = null;
}
}
constructor(){
this.count = 1;
// members
this.iterator = null;
this.err = null;
}
};
export { Lock as default };