|
@ -16,11 +16,9 @@ const EventEmitter = require('events'); |
|
|
const FSReqWrap = binding.FSReqWrap; |
|
|
const FSReqWrap = binding.FSReqWrap; |
|
|
const FSEvent = process.binding('fs_event_wrap').FSEvent; |
|
|
const FSEvent = process.binding('fs_event_wrap').FSEvent; |
|
|
const internalFS = require('internal/fs'); |
|
|
const internalFS = require('internal/fs'); |
|
|
const internalURL = require('internal/url'); |
|
|
|
|
|
const assertEncoding = internalFS.assertEncoding; |
|
|
const assertEncoding = internalFS.assertEncoding; |
|
|
const stringToFlags = internalFS.stringToFlags; |
|
|
const stringToFlags = internalFS.stringToFlags; |
|
|
const SyncWriteStream = internalFS.SyncWriteStream; |
|
|
const SyncWriteStream = internalFS.SyncWriteStream; |
|
|
const getPathFromURL = internalURL.getPathFromURL; |
|
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, 'constants', { |
|
|
Object.defineProperty(exports, 'constants', { |
|
|
configurable: false, |
|
|
configurable: false, |
|
@ -204,16 +202,6 @@ fs.Stats.prototype.isSocket = function() { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
function handleError(val, callback) { |
|
|
|
|
|
if (val instanceof Error) { |
|
|
|
|
|
if (typeof callback === 'function') { |
|
|
|
|
|
process.nextTick(callback, val); |
|
|
|
|
|
return true; |
|
|
|
|
|
} else throw val; |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fs.access = function(path, mode, callback) { |
|
|
fs.access = function(path, mode, callback) { |
|
|
if (typeof mode === 'function') { |
|
|
if (typeof mode === 'function') { |
|
|
callback = mode; |
|
|
callback = mode; |
|
@ -222,9 +210,6 @@ fs.access = function(path, mode, callback) { |
|
|
throw new TypeError('"callback" argument must be a function'); |
|
|
throw new TypeError('"callback" argument must be a function'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!nullCheck(path, callback)) |
|
|
if (!nullCheck(path, callback)) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
@ -235,7 +220,6 @@ fs.access = function(path, mode, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.accessSync = function(path, mode) { |
|
|
fs.accessSync = function(path, mode) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
|
|
|
|
|
|
if (mode === undefined) |
|
|
if (mode === undefined) |
|
@ -247,8 +231,6 @@ fs.accessSync = function(path, mode) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.exists = function(path, callback) { |
|
|
fs.exists = function(path, callback) { |
|
|
if (handleError((path = getPathFromURL(path)), cb)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, cb)) return; |
|
|
if (!nullCheck(path, cb)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = cb; |
|
|
req.oncomplete = cb; |
|
@ -260,7 +242,6 @@ fs.exists = function(path, callback) { |
|
|
|
|
|
|
|
|
fs.existsSync = function(path) { |
|
|
fs.existsSync = function(path) { |
|
|
try { |
|
|
try { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
binding.stat(pathModule._makeLong(path)); |
|
|
binding.stat(pathModule._makeLong(path)); |
|
|
return true; |
|
|
return true; |
|
@ -273,8 +254,6 @@ fs.readFile = function(path, options, callback) { |
|
|
callback = maybeCallback(arguments[arguments.length - 1]); |
|
|
callback = maybeCallback(arguments[arguments.length - 1]); |
|
|
options = getOptions(options, { flag: 'r' }); |
|
|
options = getOptions(options, { flag: 'r' }); |
|
|
|
|
|
|
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) |
|
|
if (!nullCheck(path, callback)) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
@ -558,8 +537,6 @@ fs.open = function(path, flags, mode, callback_) { |
|
|
var callback = makeCallback(arguments[arguments.length - 1]); |
|
|
var callback = makeCallback(arguments[arguments.length - 1]); |
|
|
mode = modeNum(mode, 0o666); |
|
|
mode = modeNum(mode, 0o666); |
|
|
|
|
|
|
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
|
|
|
|
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
@ -573,7 +550,6 @@ fs.open = function(path, flags, mode, callback_) { |
|
|
|
|
|
|
|
|
fs.openSync = function(path, flags, mode) { |
|
|
fs.openSync = function(path, flags, mode) { |
|
|
mode = modeNum(mode, 0o666); |
|
|
mode = modeNum(mode, 0o666); |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); |
|
|
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); |
|
|
}; |
|
|
}; |
|
@ -669,12 +645,6 @@ fs.writeSync = function(fd, buffer, offset, length, position) { |
|
|
|
|
|
|
|
|
fs.rename = function(oldPath, newPath, callback) { |
|
|
fs.rename = function(oldPath, newPath, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((oldPath = getPathFromURL(oldPath)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (handleError((newPath = getPathFromURL(newPath)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!nullCheck(oldPath, callback)) return; |
|
|
if (!nullCheck(oldPath, callback)) return; |
|
|
if (!nullCheck(newPath, callback)) return; |
|
|
if (!nullCheck(newPath, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
@ -685,8 +655,6 @@ fs.rename = function(oldPath, newPath, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.renameSync = function(oldPath, newPath) { |
|
|
fs.renameSync = function(oldPath, newPath) { |
|
|
handleError((oldPath = getPathFromURL(oldPath))); |
|
|
|
|
|
handleError((newPath = getPathFromURL(newPath))); |
|
|
|
|
|
nullCheck(oldPath); |
|
|
nullCheck(oldPath); |
|
|
nullCheck(newPath); |
|
|
nullCheck(newPath); |
|
|
return binding.rename(pathModule._makeLong(oldPath), |
|
|
return binding.rename(pathModule._makeLong(oldPath), |
|
@ -758,8 +726,6 @@ fs.ftruncateSync = function(fd, len) { |
|
|
|
|
|
|
|
|
fs.rmdir = function(path, callback) { |
|
|
fs.rmdir = function(path, callback) { |
|
|
callback = maybeCallback(callback); |
|
|
callback = maybeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -767,7 +733,6 @@ fs.rmdir = function(path, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.rmdirSync = function(path) { |
|
|
fs.rmdirSync = function(path) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.rmdir(pathModule._makeLong(path)); |
|
|
return binding.rmdir(pathModule._makeLong(path)); |
|
|
}; |
|
|
}; |
|
@ -795,8 +760,6 @@ fs.fsyncSync = function(fd) { |
|
|
fs.mkdir = function(path, mode, callback) { |
|
|
fs.mkdir = function(path, mode, callback) { |
|
|
if (typeof mode === 'function') callback = mode; |
|
|
if (typeof mode === 'function') callback = mode; |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -806,7 +769,6 @@ fs.mkdir = function(path, mode, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.mkdirSync = function(path, mode) { |
|
|
fs.mkdirSync = function(path, mode) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.mkdir(pathModule._makeLong(path), |
|
|
return binding.mkdir(pathModule._makeLong(path), |
|
|
modeNum(mode, 0o777)); |
|
|
modeNum(mode, 0o777)); |
|
@ -815,8 +777,6 @@ fs.mkdirSync = function(path, mode) { |
|
|
fs.readdir = function(path, options, callback) { |
|
|
fs.readdir = function(path, options, callback) { |
|
|
callback = makeCallback(typeof options === 'function' ? options : callback); |
|
|
callback = makeCallback(typeof options === 'function' ? options : callback); |
|
|
options = getOptions(options, {}); |
|
|
options = getOptions(options, {}); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -825,7 +785,6 @@ fs.readdir = function(path, options, callback) { |
|
|
|
|
|
|
|
|
fs.readdirSync = function(path, options) { |
|
|
fs.readdirSync = function(path, options) { |
|
|
options = getOptions(options, {}); |
|
|
options = getOptions(options, {}); |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.readdir(pathModule._makeLong(path), options.encoding); |
|
|
return binding.readdir(pathModule._makeLong(path), options.encoding); |
|
|
}; |
|
|
}; |
|
@ -838,8 +797,6 @@ fs.fstat = function(fd, callback) { |
|
|
|
|
|
|
|
|
fs.lstat = function(path, callback) { |
|
|
fs.lstat = function(path, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -848,8 +805,6 @@ fs.lstat = function(path, callback) { |
|
|
|
|
|
|
|
|
fs.stat = function(path, callback) { |
|
|
fs.stat = function(path, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -861,13 +816,11 @@ fs.fstatSync = function(fd) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.lstatSync = function(path) { |
|
|
fs.lstatSync = function(path) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.lstat(pathModule._makeLong(path)); |
|
|
return binding.lstat(pathModule._makeLong(path)); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.statSync = function(path) { |
|
|
fs.statSync = function(path) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.stat(pathModule._makeLong(path)); |
|
|
return binding.stat(pathModule._makeLong(path)); |
|
|
}; |
|
|
}; |
|
@ -875,8 +828,6 @@ fs.statSync = function(path) { |
|
|
fs.readlink = function(path, options, callback) { |
|
|
fs.readlink = function(path, options, callback) { |
|
|
callback = makeCallback(typeof options === 'function' ? options : callback); |
|
|
callback = makeCallback(typeof options === 'function' ? options : callback); |
|
|
options = getOptions(options, {}); |
|
|
options = getOptions(options, {}); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -885,7 +836,6 @@ fs.readlink = function(path, options, callback) { |
|
|
|
|
|
|
|
|
fs.readlinkSync = function(path, options) { |
|
|
fs.readlinkSync = function(path, options) { |
|
|
options = getOptions(options, {}); |
|
|
options = getOptions(options, {}); |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.readlink(pathModule._makeLong(path), options.encoding); |
|
|
return binding.readlink(pathModule._makeLong(path), options.encoding); |
|
|
}; |
|
|
}; |
|
@ -909,12 +859,6 @@ fs.symlink = function(target, path, type_, callback_) { |
|
|
var type = (typeof type_ === 'string' ? type_ : null); |
|
|
var type = (typeof type_ === 'string' ? type_ : null); |
|
|
var callback = makeCallback(arguments[arguments.length - 1]); |
|
|
var callback = makeCallback(arguments[arguments.length - 1]); |
|
|
|
|
|
|
|
|
if (handleError((target = getPathFromURL(target)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!nullCheck(target, callback)) return; |
|
|
if (!nullCheck(target, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
|
|
|
|
|
@ -929,8 +873,7 @@ fs.symlink = function(target, path, type_, callback_) { |
|
|
|
|
|
|
|
|
fs.symlinkSync = function(target, path, type) { |
|
|
fs.symlinkSync = function(target, path, type) { |
|
|
type = (typeof type === 'string' ? type : null); |
|
|
type = (typeof type === 'string' ? type : null); |
|
|
handleError((target = getPathFromURL(target))); |
|
|
|
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(target); |
|
|
nullCheck(target); |
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
|
|
|
|
|
@ -941,13 +884,6 @@ fs.symlinkSync = function(target, path, type) { |
|
|
|
|
|
|
|
|
fs.link = function(existingPath, newPath, callback) { |
|
|
fs.link = function(existingPath, newPath, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
|
|
|
|
|
|
if (handleError((existingPath = getPathFromURL(existingPath)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (handleError((newPath = getPathFromURL(newPath)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!nullCheck(existingPath, callback)) return; |
|
|
if (!nullCheck(existingPath, callback)) return; |
|
|
if (!nullCheck(newPath, callback)) return; |
|
|
if (!nullCheck(newPath, callback)) return; |
|
|
|
|
|
|
|
@ -960,8 +896,6 @@ fs.link = function(existingPath, newPath, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.linkSync = function(existingPath, newPath) { |
|
|
fs.linkSync = function(existingPath, newPath) { |
|
|
handleError((existingPath = getPathFromURL(existingPath))); |
|
|
|
|
|
handleError((newPath = getPathFromURL(newPath))); |
|
|
|
|
|
nullCheck(existingPath); |
|
|
nullCheck(existingPath); |
|
|
nullCheck(newPath); |
|
|
nullCheck(newPath); |
|
|
return binding.link(pathModule._makeLong(existingPath), |
|
|
return binding.link(pathModule._makeLong(existingPath), |
|
@ -970,8 +904,6 @@ fs.linkSync = function(existingPath, newPath) { |
|
|
|
|
|
|
|
|
fs.unlink = function(path, callback) { |
|
|
fs.unlink = function(path, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -979,7 +911,6 @@ fs.unlink = function(path, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.unlinkSync = function(path) { |
|
|
fs.unlinkSync = function(path) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.unlink(pathModule._makeLong(path)); |
|
|
return binding.unlink(pathModule._makeLong(path)); |
|
|
}; |
|
|
}; |
|
@ -1036,8 +967,6 @@ if (constants.hasOwnProperty('O_SYMLINK')) { |
|
|
|
|
|
|
|
|
fs.chmod = function(path, mode, callback) { |
|
|
fs.chmod = function(path, mode, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -1047,7 +976,6 @@ fs.chmod = function(path, mode, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.chmodSync = function(path, mode) { |
|
|
fs.chmodSync = function(path, mode) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.chmod(pathModule._makeLong(path), modeNum(mode)); |
|
|
return binding.chmod(pathModule._makeLong(path), modeNum(mode)); |
|
|
}; |
|
|
}; |
|
@ -1082,8 +1010,6 @@ fs.fchownSync = function(fd, uid, gid) { |
|
|
|
|
|
|
|
|
fs.chown = function(path, uid, gid, callback) { |
|
|
fs.chown = function(path, uid, gid, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -1091,7 +1017,6 @@ fs.chown = function(path, uid, gid, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.chownSync = function(path, uid, gid) { |
|
|
fs.chownSync = function(path, uid, gid) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
return binding.chown(pathModule._makeLong(path), uid, gid); |
|
|
return binding.chown(pathModule._makeLong(path), uid, gid); |
|
|
}; |
|
|
}; |
|
@ -1119,8 +1044,6 @@ fs._toUnixTimestamp = toUnixTimestamp; |
|
|
|
|
|
|
|
|
fs.utimes = function(path, atime, mtime, callback) { |
|
|
fs.utimes = function(path, atime, mtime, callback) { |
|
|
callback = makeCallback(callback); |
|
|
callback = makeCallback(callback); |
|
|
if (handleError((path = getPathFromURL(path)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(path, callback)) return; |
|
|
if (!nullCheck(path, callback)) return; |
|
|
var req = new FSReqWrap(); |
|
|
var req = new FSReqWrap(); |
|
|
req.oncomplete = callback; |
|
|
req.oncomplete = callback; |
|
@ -1131,7 +1054,6 @@ fs.utimes = function(path, atime, mtime, callback) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.utimesSync = function(path, atime, mtime) { |
|
|
fs.utimesSync = function(path, atime, mtime) { |
|
|
handleError((path = getPathFromURL(path))); |
|
|
|
|
|
nullCheck(path); |
|
|
nullCheck(path); |
|
|
atime = toUnixTimestamp(atime); |
|
|
atime = toUnixTimestamp(atime); |
|
|
mtime = toUnixTimestamp(mtime); |
|
|
mtime = toUnixTimestamp(mtime); |
|
@ -1292,7 +1214,6 @@ FSWatcher.prototype.start = function(filename, |
|
|
persistent, |
|
|
persistent, |
|
|
recursive, |
|
|
recursive, |
|
|
encoding) { |
|
|
encoding) { |
|
|
handleError((filename = getPathFromURL(filename))); |
|
|
|
|
|
nullCheck(filename); |
|
|
nullCheck(filename); |
|
|
var err = this._handle.start(pathModule._makeLong(filename), |
|
|
var err = this._handle.start(pathModule._makeLong(filename), |
|
|
persistent, |
|
|
persistent, |
|
@ -1311,7 +1232,6 @@ FSWatcher.prototype.close = function() { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.watch = function(filename, options, listener) { |
|
|
fs.watch = function(filename, options, listener) { |
|
|
handleError((filename = getPathFromURL(filename))); |
|
|
|
|
|
nullCheck(filename); |
|
|
nullCheck(filename); |
|
|
|
|
|
|
|
|
if (typeof options === 'function') { |
|
|
if (typeof options === 'function') { |
|
@ -1372,7 +1292,6 @@ util.inherits(StatWatcher, EventEmitter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StatWatcher.prototype.start = function(filename, persistent, interval) { |
|
|
StatWatcher.prototype.start = function(filename, persistent, interval) { |
|
|
handleError((filename = getPathFromURL(filename))); |
|
|
|
|
|
nullCheck(filename); |
|
|
nullCheck(filename); |
|
|
this._handle.start(pathModule._makeLong(filename), persistent, interval); |
|
|
this._handle.start(pathModule._makeLong(filename), persistent, interval); |
|
|
}; |
|
|
}; |
|
@ -1386,7 +1305,6 @@ StatWatcher.prototype.stop = function() { |
|
|
const statWatchers = new Map(); |
|
|
const statWatchers = new Map(); |
|
|
|
|
|
|
|
|
fs.watchFile = function(filename, options, listener) { |
|
|
fs.watchFile = function(filename, options, listener) { |
|
|
handleError((filename = getPathFromURL(filename))); |
|
|
|
|
|
nullCheck(filename); |
|
|
nullCheck(filename); |
|
|
filename = pathModule.resolve(filename); |
|
|
filename = pathModule.resolve(filename); |
|
|
var stat; |
|
|
var stat; |
|
@ -1423,7 +1341,6 @@ fs.watchFile = function(filename, options, listener) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.unwatchFile = function(filename, listener) { |
|
|
fs.unwatchFile = function(filename, listener) { |
|
|
handleError((filename = getPathFromURL(filename))); |
|
|
|
|
|
nullCheck(filename); |
|
|
nullCheck(filename); |
|
|
filename = pathModule.resolve(filename); |
|
|
filename = pathModule.resolve(filename); |
|
|
var stat = statWatchers.get(filename); |
|
|
var stat = statWatchers.get(filename); |
|
@ -1467,7 +1384,6 @@ function encodeRealpathResult(result, options) { |
|
|
|
|
|
|
|
|
fs.realpathSync = function realpathSync(p, options) { |
|
|
fs.realpathSync = function realpathSync(p, options) { |
|
|
options = getOptions(options, {}); |
|
|
options = getOptions(options, {}); |
|
|
handleError((p = getPathFromURL(p))); |
|
|
|
|
|
nullCheck(p); |
|
|
nullCheck(p); |
|
|
|
|
|
|
|
|
p = p.toString('utf8'); |
|
|
p = p.toString('utf8'); |
|
@ -1571,8 +1487,6 @@ fs.realpathSync = function realpathSync(p, options) { |
|
|
fs.realpath = function realpath(p, options, callback) { |
|
|
fs.realpath = function realpath(p, options, callback) { |
|
|
callback = maybeCallback(typeof options === 'function' ? options : callback); |
|
|
callback = maybeCallback(typeof options === 'function' ? options : callback); |
|
|
options = getOptions(options, {}); |
|
|
options = getOptions(options, {}); |
|
|
if (handleError((p = getPathFromURL(p)), callback)) |
|
|
|
|
|
return; |
|
|
|
|
|
if (!nullCheck(p, callback)) |
|
|
if (!nullCheck(p, callback)) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
@ -1731,7 +1645,7 @@ function ReadStream(path, options) { |
|
|
|
|
|
|
|
|
Readable.call(this, options); |
|
|
Readable.call(this, options); |
|
|
|
|
|
|
|
|
handleError((this.path = getPathFromURL(path))); |
|
|
this.path = path; |
|
|
this.fd = options.fd === undefined ? null : options.fd; |
|
|
this.fd = options.fd === undefined ? null : options.fd; |
|
|
this.flags = options.flags === undefined ? 'r' : options.flags; |
|
|
this.flags = options.flags === undefined ? 'r' : options.flags; |
|
|
this.mode = options.mode === undefined ? 0o666 : options.mode; |
|
|
this.mode = options.mode === undefined ? 0o666 : options.mode; |
|
@ -1894,7 +1808,7 @@ function WriteStream(path, options) { |
|
|
|
|
|
|
|
|
Writable.call(this, options); |
|
|
Writable.call(this, options); |
|
|
|
|
|
|
|
|
handleError((this.path = getPathFromURL(path))); |
|
|
this.path = path; |
|
|
this.fd = options.fd === undefined ? null : options.fd; |
|
|
this.fd = options.fd === undefined ? null : options.fd; |
|
|
this.flags = options.flags === undefined ? 'w' : options.flags; |
|
|
this.flags = options.flags === undefined ? 'w' : options.flags; |
|
|
this.mode = options.mode === undefined ? 0o666 : options.mode; |
|
|
this.mode = options.mode === undefined ? 0o666 : options.mode; |
|
|