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