|
|
@ -150,7 +150,7 @@ fs.openSync = function (path, flags, mode) { |
|
|
|
}; |
|
|
|
|
|
|
|
fs.read = function (fd, buffer, offset, length, position, callback) { |
|
|
|
if (!(buffer instanceof Buffer)) { |
|
|
|
if (!Buffer.isBuffer(buffer)) { |
|
|
|
// legacy string interface (fd, length, position, encoding, callback)
|
|
|
|
var cb = arguments[4], |
|
|
|
encoding = arguments[3]; |
|
|
@ -175,7 +175,7 @@ fs.read = function (fd, buffer, offset, length, position, callback) { |
|
|
|
|
|
|
|
fs.readSync = function (fd, buffer, offset, length, position) { |
|
|
|
var legacy = false; |
|
|
|
if (!(buffer instanceof Buffer)) { |
|
|
|
if (!Buffer.isBuffer(buffer)) { |
|
|
|
// legacy string interface (fd, length, position, encoding, callback)
|
|
|
|
legacy = true; |
|
|
|
encoding = arguments[3]; |
|
|
@ -198,7 +198,7 @@ fs.readSync = function (fd, buffer, offset, length, position) { |
|
|
|
}; |
|
|
|
|
|
|
|
fs.write = function (fd, buffer, offset, length, position, callback) { |
|
|
|
if (!(buffer instanceof Buffer)) { |
|
|
|
if (!Buffer.isBuffer(buffer)) { |
|
|
|
// legacy string interface (fd, data, position, encoding, callback)
|
|
|
|
callback = arguments[4]; |
|
|
|
position = arguments[2]; |
|
|
@ -212,7 +212,7 @@ fs.write = function (fd, buffer, offset, length, position, callback) { |
|
|
|
}; |
|
|
|
|
|
|
|
fs.writeSync = function (fd, buffer, offset, length, position) { |
|
|
|
if (!(buffer instanceof Buffer)) { |
|
|
|
if (!Buffer.isBuffer(buffer)) { |
|
|
|
// legacy string interface (fd, data, position, encoding)
|
|
|
|
position = arguments[2]; |
|
|
|
|
|
|
@ -384,7 +384,7 @@ fs.writeFile = function (path, data, encoding_, callback) { |
|
|
|
if (openErr) { |
|
|
|
if (callback) callback(openErr); |
|
|
|
} else { |
|
|
|
var buffer = data instanceof Buffer ? data : new Buffer(data, encoding); |
|
|
|
var buffer = Buffer.isBuffer(data) ? data : new Buffer(data, encoding); |
|
|
|
writeAll(fd, buffer, callback); |
|
|
|
} |
|
|
|
}); |
|
|
@ -864,7 +864,7 @@ WriteStream.prototype.write = function (data) { |
|
|
|
cb = arguments[arguments.length-1]; |
|
|
|
} |
|
|
|
|
|
|
|
if (data instanceof Buffer) { |
|
|
|
if (Buffer.isBuffer(data)) { |
|
|
|
this._queue.push([fs.write, data, 0, data.length, null, cb]); |
|
|
|
} else { |
|
|
|
var encoding = 'utf8'; |
|
|
|