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

Function lstatSync

lib/fs.js:2044–2066  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

2042 * @returns {Stats | undefined}
2043 */
2044function lstatSync(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }) {
2045 const h = vfsState.handlers;
2046 if (h !== null) {
2047 const result = h.lstatSync(path, options);
2048 if (result !== undefined) return result;
2049 }
2050 path = getValidatedPath(path);
2051 if (permission.isEnabled() && !permission.has('fs.read', path)) {
2052 const resource = BufferIsBuffer(path) ? BufferToString(path) : path;
2053 throw new ERR_ACCESS_DENIED('Access to this API has been restricted', 'FileSystemRead', resource);
2054 }
2055 const stats = binding.lstat(
2056 path,
2057 options.bigint,
2058 undefined,
2059 options.throwIfNoEntry,
2060 );
2061
2062 if (stats === undefined) {
2063 return;
2064 }
2065 return getStatsFromBinding(stats);
2066}
2067
2068/**
2069 * Synchronously retrieves the `fs.Stats`

Calls 5

getStatsFromBindingFunction · 0.85
isEnabledMethod · 0.80
hasMethod · 0.65
lstatSyncMethod · 0.45
lstatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…