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

Function lchmod

lib/fs.js:2390–2410  ·  view source on GitHub ↗

* Changes the permissions on a symbolic link. * @param {string | Buffer | URL} path * @param {number} mode * @param {(err?: Error) => any} callback * @returns {void}

(path, mode, callback)

Source from the content-addressed store, hash-verified

2388 * @returns {void}
2389 */
2390function lchmod(path, mode, callback) {
2391 validateFunction(callback, 'cb');
2392 mode = parseFileMode(mode, 'mode');
2393
2394 const h = vfsState.handlers;
2395 if (h !== null && vfsVoid(h.lchmod(path, mode), callback)) return;
2396
2397 fs.open(path, O_WRONLY | O_SYMLINK, (err, fd) => {
2398 if (err) {
2399 callback(err);
2400 return;
2401 }
2402 // Prefer to return the chmod error, if one occurs,
2403 // but still try to close, and report closing errors if they occur.
2404 fs.fchmod(fd, mode, (err) => {
2405 fs.close(fd, (err2) => {
2406 callback(aggregateTwoErrors(err2, err));
2407 });
2408 });
2409 });
2410}
2411
2412/**
2413 * Synchronously changes the permissions on a symbolic link.

Calls 7

parseFileModeFunction · 0.85
vfsVoidFunction · 0.85
aggregateTwoErrorsFunction · 0.85
lchmodMethod · 0.80
openMethod · 0.65
closeMethod · 0.65
callbackFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…