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

Function statSync

lib/fs.js:2078–2094  ·  view source on GitHub ↗

* Synchronously retrieves the `fs.Stats` * for the `path`. * @param {string | Buffer | URL} path * @param {{ * bigint?: boolean; * throwIfNoEntry?: boolean; * }} [options] * @returns {Stats}

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

Source from the content-addressed store, hash-verified

2076 * @returns {Stats}
2077 */
2078function statSync(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }) {
2079 const h = vfsState.handlers;
2080 if (h !== null) {
2081 const result = h.statSync(path, options);
2082 if (result !== undefined) return result;
2083 }
2084 const stats = binding.stat(
2085 getValidatedPath(path),
2086 options.bigint,
2087 undefined,
2088 options.throwIfNoEntry,
2089 );
2090 if (stats === undefined) {
2091 return undefined;
2092 }
2093 return getStatsFromBinding(stats);
2094}
2095
2096function statfsSync(path, options = { __proto__: null, bigint: false }) {
2097 const h = vfsState.handlers;

Callers 4

symlinkSyncFunction · 0.70
setWorkspaceMethod · 0.50
version.jsFile · 0.50
readNonJsFilesFunction · 0.50

Calls 3

getStatsFromBindingFunction · 0.85
statSyncMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…