diff options
Diffstat (limited to 'lib/fs.js')
-rw-r--r-- | lib/fs.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1650,12 +1650,14 @@ WriteStream.prototype.open = function() { }; -WriteStream.prototype._write = function(data, cb) { +WriteStream.prototype._write = function(data, encoding, cb) { if (!Buffer.isBuffer(data)) return this.emit('error', new Error('Invalid data')); if (typeof this.fd !== 'number') - return this.once('open', this._write.bind(this, data, cb)); + return this.once('open', function() { + this._write(data, encoding, cb); + }); var self = this; fs.write(this.fd, data, 0, data.length, this.pos, function(er, bytes) { |