Skip to content

Commit

Permalink
fix: do not let empty file on error (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrosSacASac committed Dec 12, 2021
1 parent fac24dc commit f4ab0ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/PersistentFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ class PersistentFile extends EventEmitter {

destroy() {
this._writeStream.destroy();
unlink(this.filepath, () => {});
const filepath = this.filepath;
setTimeout(function () {
unlink(filepath, () => {});
}, 1)
}
}

Expand Down

0 comments on commit f4ab0ad

Please sign in to comment.