MCPcopy Index your code
hub / github.com/nodejs/node / stat

Function stat

lib/fs.js:1963–1984  ·  view source on GitHub ↗

* Asynchronously gets the stats of a file. * @param {string | Buffer | URL} path * @param {{ bigint?: boolean, signal?: AbortSignal }} [options] * @param {( * err?: Error, * stats?: Stats * ) => any} callback * @returns {void}

(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }, callback)

Source from the content-addressed store, hash-verified

1961 * @returns {void}
1962 */
1963function stat(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }, callback) {
1964 if (typeof options === 'function') {
1965 callback = options;
1966 options = kEmptyObject;
1967 } else if (options === null || typeof options !== 'object') {
1968 options = kEmptyObject;
1969 } else {
1970 options = getOptions(options, { bigint: false });
1971 }
1972
1973 const h = vfsState.handlers;
1974 if (h !== null && vfsResult(h.stat(path, options), callback)) return;
1975
1976 callback = makeStatsCallback(callback);
1977 path = getValidatedPath(path);
1978
1979 if (checkAborted(options.signal, callback)) return;
1980
1981 const req = new FSReqCallback(options.bigint);
1982 req.oncomplete = callback;
1983 binding.stat(getValidatedPath(path), options.bigint, req, options.throwIfNoEntry);
1984}
1985
1986function statfs(path, options = { __proto__: null, bigint: false }, callback) {
1987 if (typeof options === 'function') {

Callers 2

symlinkFunction · 0.70
updateNotifierFunction · 0.50

Calls 5

vfsResultFunction · 0.85
makeStatsCallbackFunction · 0.85
checkAbortedFunction · 0.70
getOptionsFunction · 0.50
statMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…