MCPcopy Create free account
hub / github.com/nodejs/node / chown

Function chown

lib/fs.js:2571–2583  ·  view source on GitHub ↗

* Asynchronously changes the owner and group * of a file. * @param {string | Buffer | URL} path * @param {number} uid * @param {number} gid * @param {(err?: Error) => any} callback * @returns {void}

(path, uid, gid, callback)

Source from the content-addressed store, hash-verified

2569 * @returns {void}
2570 */
2571function chown(path, uid, gid, callback) {
2572 callback = makeCallback(callback);
2573 path = getValidatedPath(path);
2574 validateInteger(uid, 'uid', -1, kMaxUserId);
2575 validateInteger(gid, 'gid', -1, kMaxUserId);
2576
2577 const h = vfsState.handlers;
2578 if (h !== null && vfsVoid(h.chown(path, uid, gid), callback)) return;
2579
2580 const req = new FSReqCallback();
2581 req.oncomplete = callback;
2582 binding.chown(path, uid, gid, req);
2583}
2584
2585/**
2586 * Synchronously changes the owner and group

Callers

nothing calls this directly

Calls 3

vfsVoidFunction · 0.85
makeCallbackFunction · 0.70
chownMethod · 0.45

Tested by

no test coverage detected