Skip to content

Commit 6041695

Browse files
authored
Merge pull request #455 from Vitaha/master
Fix using closed _writeStream when error is occurred (#357)
2 parents c7e47cd + 5ddd6d3 commit 6041695

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/file.js

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ File.prototype.write = function(buffer, cb) {
5656
if (self.hash) {
5757
self.hash.update(buffer);
5858
}
59+
60+
if (this._writeStream.closed) {
61+
return cb();
62+
}
63+
5964
this._writeStream.write(buffer, function() {
6065
self.lastModifiedDate = new Date();
6166
self.size += buffer.length;

0 commit comments

Comments
 (0)