This commit is contained in:
2018-07-07 16:30:57 +03:00
parent 820b639427
commit 54830d1d01
4 changed files with 16 additions and 10 deletions

View File

@@ -11,13 +11,17 @@ class TailVinyl extends Vinyl {
constructor(params) {
params.contents = new Transform();
super(params);
this.tail = new Tail(params.path);
this.tail.on('line', data => this.contents.write(data + '\n'));
this.tail.on('error', error => this.contents.write('error: ' + error));
if (params.path) {
this.tail = new Tail(params.path);
this.tail.on('line', data => this.contents.write(data + '\n'));
this.tail.on('error', error => this.contents.write('error: ' + error));
}
}
dispose() {
this.tail.unwatch();
if (this.tail) {
this.tail.unwatch();
}
this.contents.destroy();
}
}