@@ -248,7 +248,7 @@ function readFileAfterOpen(err, fd) {
const req = new FSReqWrap ();
req .oncomplete = readFileAfterStat;
req .context = context;
binding .fstat (fd, req);
binding .fstat (fd, false , req);
}
function readFileAfterStat (err , stats ) {
@@ -307,7 +307,7 @@ function readFile(path, options, callback) {
function tryStatSync (fd , isUserFd ) {
const ctx = {};
const stats = binding .fstat (fd, undefined , ctx);
const stats = binding .fstat (fd, false , undefined , ctx);
if (ctx .errno !== undefined && ! isUserFd) {
fs .closeSync (fd);
throw errors .uvException (ctx);
@@ -760,55 +760,67 @@ function readdirSync(path, options) {
return result;
}
function fstat (fd , callback ) {
function fstat (fd , options , callback ) {
if (arguments .length < 3 ) {
callback = options;
options = {};
}
validateUint32 (fd, ' fd' );
const req = new FSReqWrap ();
const req = new FSReqWrap (options . bigint );
req .oncomplete = makeStatsCallback (callback);
binding .fstat (fd, req);
binding .fstat (fd, options . bigint , req);
}
function lstat (path , callback ) {
function lstat (path , options , callback ) {
if (arguments .length < 3 ) {
callback = options;
options = {};
}
callback = makeStatsCallback (callback);
path = getPathFromURL (path);
validatePath (path);
const req = new FSReqWrap ();
const req = new FSReqWrap (options . bigint );
req .oncomplete = callback;
binding .lstat (pathModule .toNamespacedPath (path), req);
binding .lstat (pathModule .toNamespacedPath (path), options . bigint , req);
}
function stat (path , callback ) {
function stat (path , options , callback ) {
if (arguments .length < 3 ) {
callback = options;
options = {};
}
callback = makeStatsCallback (callback);
path = getPathFromURL (path);
validatePath (path);
const req = new FSReqWrap ();
const req = new FSReqWrap (options . bigint );
req .oncomplete = callback;
binding .stat (pathModule .toNamespacedPath (path), req);
binding .stat (pathModule .toNamespacedPath (path), options . bigint , req);
}
function fstatSync (fd ) {
function fstatSync (fd , options = {} ) {
validateUint32 (fd, ' fd' );
const ctx = { fd };
const stats = binding .fstat (fd, undefined , ctx);
const stats = binding .fstat (fd, options . bigint , undefined , ctx);
handleErrorFromBinding (ctx);
return getStatsFromBinding (stats);
}
function lstatSync (path ) {
function lstatSync (path , options = {} ) {
path = getPathFromURL (path);
validatePath (path);
const ctx = { path };
const stats = binding .lstat (pathModule .toNamespacedPath (path),
undefined , ctx);
options . bigint , undefined , ctx);
handleErrorFromBinding (ctx);
return getStatsFromBinding (stats);
}
function statSync (path ) {
function statSync (path , options = {} ) {
path = getPathFromURL (path);
validatePath (path);
const ctx = { path };
const stats = binding .stat (pathModule .toNamespacedPath (path),
undefined , ctx);
options . bigint , undefined , ctx);
handleErrorFromBinding (ctx);
return getStatsFromBinding (stats);
}
@@ -1264,7 +1276,7 @@ function watchFile(filename, options, listener) {
if (stat === undefined ) {
if (! watchers)
watchers = require (' internal/fs/watchers' );
stat = new watchers.StatWatcher ();
stat = new watchers.StatWatcher (options . bigint );
stat .start (filename, options .persistent , options .interval );
statWatchers .set (filename, stat);
}
@@ -1379,7 +1391,7 @@ function realpathSync(p, options) {
// On windows, check that the root exists. On unix there is no need.
if (isWindows && ! knownHard[base]) {
const ctx = { path: base };
binding .lstat (pathModule .toNamespacedPath (base), undefined , ctx);
binding .lstat (pathModule .toNamespacedPath (base), false , undefined , ctx);
handleErrorFromBinding (ctx);
knownHard[base] = true ;
}
@@ -1421,7 +1433,7 @@ function realpathSync(p, options) {
const baseLong = pathModule .toNamespacedPath (base);
const ctx = { path: base };
const stats = binding .lstat (baseLong, undefined , ctx);
const stats = binding .lstat (baseLong, false , undefined , ctx);
handleErrorFromBinding (ctx);
if (! isFileType (stats, S_IFLNK )) {
@@ -1444,7 +1456,7 @@ function realpathSync(p, options) {
}
if (linkTarget === null ) {
const ctx = { path: base };
binding .stat (baseLong, undefined , ctx);
binding .stat (baseLong, false , undefined , ctx);
handleErrorFromBinding (ctx);
linkTarget = binding .readlink (baseLong, undefined , undefined , ctx);
handleErrorFromBinding (ctx);
@@ -1465,7 +1477,7 @@ function realpathSync(p, options) {
// On windows, check that the root exists. On unix there is no need.
if (isWindows && ! knownHard[base]) {
const ctx = { path: base };
binding .lstat (pathModule .toNamespacedPath (base), undefined , ctx);
binding .lstat (pathModule .toNamespacedPath (base), false , undefined , ctx);
handleErrorFromBinding (ctx);
knownHard[base] = true ;
}
0 comments on commit
04e8f07