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

Function lstat

lib/fs.js:1931–1951  ·  view source on GitHub ↗

* Retrieves the `fs.Stats` for the symbolic link * referred to by the `path`. * @param {string | Buffer | URL} path * @param {{ bigint?: boolean; }} [options] * @param {( * err?: Error, * stats?: Stats * ) => any} callback * @returns {void}

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

Source from the content-addressed store, hash-verified

1929 * @returns {void}
1930 */
1931function lstat(path, options = { __proto__: null, bigint: false }, callback) {
1932 if (typeof options === 'function') {
1933 callback = options;
1934 options = kEmptyObject;
1935 }
1936
1937 const h = vfsState.handlers;
1938 if (h !== null && vfsResult(h.lstat(path, options), callback)) return;
1939
1940 callback = makeStatsCallback(callback);
1941 path = getValidatedPath(path);
1942 if (permission.isEnabled() && !permission.has('fs.read', path)) {
1943 const resource = BufferIsBuffer(path) ? BufferToString(path) : path;
1944 callback(new ERR_ACCESS_DENIED('Access to this API has been restricted', 'FileSystemRead', resource));
1945 return;
1946 }
1947
1948 const req = new FSReqCallback(options.bigint);
1949 req.oncomplete = callback;
1950 binding.lstat(path, options.bigint, req);
1951}
1952
1953/**
1954 * Asynchronously gets the stats of a file.

Callers 2

checkFilesPermissionMethod · 0.50
execMethod · 0.50

Calls 6

vfsResultFunction · 0.85
makeStatsCallbackFunction · 0.85
isEnabledMethod · 0.80
hasMethod · 0.65
callbackFunction · 0.50
lstatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…