Server IP : 85.214.239.14 / Your IP : 13.58.197.93 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/cwd/usr/lib/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/ |
Upload File : |
import fs from 'node:fs'; import path from 'node:path'; const lchownSync = (path, uid, gid) => { try { return fs.lchownSync(path, uid, gid); } catch (er) { if (er?.code !== 'ENOENT') throw er; } }; const chown = (cpath, uid, gid, cb) => { fs.lchown(cpath, uid, gid, er => { // Skip ENOENT error cb(er && er?.code !== 'ENOENT' ? er : null); }); }; const chownrKid = (p, child, uid, gid, cb) => { if (child.isDirectory()) { chownr(path.resolve(p, child.name), uid, gid, (er) => { if (er) return cb(er); const cpath = path.resolve(p, child.name); chown(cpath, uid, gid, cb); }); } else { const cpath = path.resolve(p, child.name); chown(cpath, uid, gid, cb); } }; export const chownr = (p, uid, gid, cb) => { fs.readdir(p, { withFileTypes: true }, (er, children) => { // any error other than ENOTDIR or ENOTSUP means it's not readable, // or doesn't exist. give up. if (er) { if (er.code === 'ENOENT') return cb(); else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') return cb(er); } if (er || !children.length) return chown(p, uid, gid, cb); let len = children.length; let errState = null; const then = (er) => { /* c8 ignore start */ if (errState) return; /* c8 ignore stop */ if (er) return cb((errState = er)); if (--len === 0) return chown(p, uid, gid, cb); }; for (const child of children) { chownrKid(p, child, uid, gid, then); } }); }; const chownrKidSync = (p, child, uid, gid) => { if (child.isDirectory()) chownrSync(path.resolve(p, child.name), uid, gid); lchownSync(path.resolve(p, child.name), uid, gid); }; export const chownrSync = (p, uid, gid) => { let children; try { children = fs.readdirSync(p, { withFileTypes: true }); } catch (er) { const e = er; if (e?.code === 'ENOENT') return; else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') return lchownSync(p, uid, gid); else throw e; } for (const child of children) { chownrKidSync(p, child, uid, gid); } return lchownSync(p, uid, gid); }; //# sourceMappingURL=index.js.map