Lines Matching refs:path
60 const pathModule = require('path');
220 * specified by `path`.
221 * @param {string | Buffer | URL} path
226 function access(path, mode, callback) {
232 path = getValidatedPath(path);
238 binding.access(pathModule.toNamespacedPath(path), mode, req);
243 * directory specified by `path`.
244 * @param {string | Buffer | URL} path
248 function accessSync(path, mode) {
249 path = getValidatedPath(path);
252 const ctx = { path };
253 binding.access(pathModule.toNamespacedPath(path), mode, undefined, ctx);
258 * Tests whether or not the given path exists.
259 * @param {string | Buffer | URL} path
263 function exists(path, callback) {
271 fs.access(path, F_OK, suppressedCallback);
279 value: function exists(path) { // eslint-disable-line func-name-matching
280 return new Promise((resolve) => fs.exists(path, resolve));
291 * Synchronously tests whether or not the given path exists.
292 * @param {string | Buffer | URL} path
295 function existsSync(path) {
297 path = getValidatedPath(path);
301 const ctx = { path };
302 const nPath = pathModule.toNamespacedPath(path);
371 * @param {string | Buffer | URL | number} path
383 function readFile(path, options, callback) {
388 context.isUserFd = isFd(path); // File descriptor ownership
395 ReflectApply(readFileAfterOpen, { context }, [null, path]);
404 path = getValidatedPath(path);
409 binding.open(pathModule.toNamespacedPath(path),
454 * @param {string | Buffer | URL | number} path
461 function readFileSync(path, options) {
463 const isUserFd = isFd(path); // File descriptor ownership
464 const fd = isUserFd ? path : fs.openSync(path, options.flag, 0o666);
547 * @param {string | Buffer | URL} path
556 function open(path, flags, mode, callback) {
557 path = getValidatedPath(path);
574 binding.open(pathModule.toNamespacedPath(path),
582 * @param {string | Buffer | URL} path
587 function openSync(path, flags, mode) {
588 path = getValidatedPath(path);
592 const ctx = { path };
593 const result = binding.open(pathModule.toNamespacedPath(path),
1032 const ctx = { path: oldPath, dest: newPath };
1040 * @param {string | Buffer | URL} path
1045 function truncate(path, len, callback) {
1046 if (typeof path === 'number') {
1048 return fs.ftruncate(path, len, callback);
1060 fs.open(path, 'r+', (er, fd) => {
1074 * @param {string | Buffer | URL} path
1078 function truncateSync(path, len) {
1079 if (typeof path === 'number') {
1082 return fs.ftruncateSync(path, len);
1088 const fd = fs.openSync(path, 'r+');
1151 * @param {string | Buffer | URL} path
1160 function rmdir(path, options, callback) {
1167 path = pathModule.toNamespacedPath(getValidatedPath(path));
1172 path,
1179 return binding.rmdir(path, req);
1186 rimraf(path, options, callback);
1192 return binding.rmdir(path, req);
1198 * @param {string | Buffer | URL} path
1206 function rmdirSync(path, options) {
1207 path = getValidatedPath(path);
1211 options = validateRmOptionsSync(path, { ...options, force: false }, true);
1214 return rimrafSync(pathModule.toNamespacedPath(path), options);
1220 const ctx = { path };
1221 binding.rmdir(pathModule.toNamespacedPath(path), undefined, ctx);
1228 * @param {string | Buffer | URL} path
1238 function rm(path, options, callback) {
1243 path = getValidatedPath(path);
1245 validateRmOptions(path, options, false, (err, options) => {
1250 return rimraf(pathModule.toNamespacedPath(path), options, callback);
1257 * @param {string | Buffer | URL} path
1266 function rmSync(path, options) {
1267 path = getValidatedPath(path);
1268 options = validateRmOptionsSync(path, options, false);
1271 return rimrafSync(pathModule.toNamespacedPath(path), options);
1332 * @param {string | Buffer | URL} path
1340 function mkdir(path, options, callback) {
1354 path = getValidatedPath(path);
1360 binding.mkdir(pathModule.toNamespacedPath(path),
1366 * @param {string | Buffer | URL} path
1373 function mkdirSync(path, options) {
1384 path = getValidatedPath(path);
1387 const ctx = { path };
1388 const result = binding.mkdir(pathModule.toNamespacedPath(path),
1412 const ctx = { path: basePath };
1413 function read(path) {
1414 ctx.path = path;
1416 pathModule.toNamespacedPath(path),
1431 const dirent = getDirent(path, readdirResult[0][i], readdirResult[1][i]);
1434 ArrayPrototypePush(pathsQueue, pathModule.join(dirent.path, dirent.name));
1439 const resultPath = pathModule.join(path, readdirResult[i]);
1460 * @param {string | Buffer | URL} path
1471 function readdir(path, options, callback) {
1474 path = getValidatedPath(path);
1480 callback(null, readdirSyncRecursive(path, options));
1493 getDirents(path, result, callback);
1496 binding.readdir(pathModule.toNamespacedPath(path), options.encoding,
1502 * @param {string | Buffer | URL} path
1510 function readdirSync(path, options) {
1512 path = getValidatedPath(path);
1518 return readdirSyncRecursive(path, options);
1521 const ctx = { path };
1522 const result = binding.readdir(pathModule.toNamespacedPath(path),
1526 return options.withFileTypes ? getDirents(path, result) : result;
1555 * referred to by the `path`.
1556 * @param {string | Buffer | URL} path
1564 function lstat(path, options = { bigint: false }, callback) {
1570 path = getValidatedPath(path);
1574 binding.lstat(pathModule.toNamespacedPath(path), options.bigint, req);
1579 * @param {string | Buffer | URL} path
1587 function stat(path, options = { bigint: false }, callback) {
1593 path = getValidatedPath(path);
1597 binding.stat(pathModule.toNamespacedPath(path), options.bigint, req);
1600 function statfs(path, options = { bigint: false }, callback) {
1606 path = getValidatedPath(path);
1615 binding.statfs(pathModule.toNamespacedPath(path), options.bigint, req);
1650 * the symbolic link referred to by the `path`.
1651 * @param {string | Buffer | URL} path
1658 function lstatSync(path, options = { bigint: false, throwIfNoEntry: true }) {
1659 path = getValidatedPath(path);
1660 const ctx = { path };
1661 const stats = binding.lstat(pathModule.toNamespacedPath(path),
1672 * for the `path`.
1673 * @param {string | Buffer | URL} path
1680 function statSync(path, options = { bigint: false, throwIfNoEntry: true }) {
1681 path = getValidatedPath(path);
1682 const ctx = { path };
1683 const stats = binding.stat(pathModule.toNamespacedPath(path),
1692 function statfsSync(path, options = { bigint: false }) {
1693 path = getValidatedPath(path);
1694 const ctx = { path };
1695 const stats = binding.statfs(pathModule.toNamespacedPath(path),
1703 * referred to by `path`.
1704 * @param {string | Buffer | URL} path
1712 function readlink(path, options, callback) {
1715 path = getValidatedPath(path, 'oldPath');
1718 binding.readlink(pathModule.toNamespacedPath(path), options.encoding, req);
1723 * referred to by `path`.
1724 * @param {string | Buffer | URL} path
1728 function readlinkSync(path, options) {
1730 path = getValidatedPath(path, 'oldPath');
1731 const ctx = { path };
1732 const result = binding.readlink(pathModule.toNamespacedPath(path),
1739 * Creates the link called `path` pointing to `target`.
1741 * @param {string | Buffer | URL} path
1746 function symlink(target, path, type_, callback_) {
1751 path = getValidatedPath(path);
1756 // Symlinks targets can be relative to the newly created path.
1759 // errors consistent between platforms if invalid path is
1761 absoluteTarget = pathModule.resolve(path, '..', target);
1771 path);
1776 pathModule.toNamespacedPath(path), resolvedFlags, req);
1782 const destination = preprocessSymlinkDestination(target, type, path);
1787 binding.symlink(destination, pathModule.toNamespacedPath(path), flags, req);
1791 * Synchronously creates the link called `path`
1794 * @param {string | Buffer | URL} path
1798 function symlinkSync(target, path, type) {
1801 const absoluteTarget = pathModule.resolve(`${path}`, '..', `${target}`);
1807 path = getValidatedPath(path);
1810 const ctx = { path: target, dest: path };
1811 binding.symlink(preprocessSymlinkDestination(target, type, path),
1812 pathModule.toNamespacedPath(path), flags, undefined, ctx);
1850 const ctx = { path: existingPath, dest: newPath };
1860 * @param {string | Buffer | URL} path
1864 function unlink(path, callback) {
1866 path = getValidatedPath(path);
1869 binding.unlink(pathModule.toNamespacedPath(path), req);
1874 * @param {string | Buffer | URL} path
1877 function unlinkSync(path) {
1878 path = getValidatedPath(path);
1879 const ctx = { path };
1880 binding.unlink(pathModule.toNamespacedPath(path), undefined, ctx);
1917 * @param {string | Buffer | URL} path
1922 function lchmod(path, mode, callback) {
1925 fs.open(path, O_WRONLY | O_SYMLINK, (err, fd) => {
1942 * @param {string | Buffer | URL} path
1946 function lchmodSync(path, mode) {
1947 const fd = fs.openSync(path, O_WRONLY | O_SYMLINK);
1962 * @param {string | Buffer | URL} path
1967 function chmod(path, mode, callback) {
1968 path = getValidatedPath(path);
1974 binding.chmod(pathModule.toNamespacedPath(path), mode, req);
1979 * @param {string | Buffer | URL} path
1983 function chmodSync(path, mode) {
1984 path = getValidatedPath(path);
1987 const ctx = { path };
1988 binding.chmod(pathModule.toNamespacedPath(path), mode, undefined, ctx);
1994 * @param {string | Buffer | URL} path
2000 function lchown(path, uid, gid, callback) {
2002 path = getValidatedPath(path);
2007 binding.lchown(pathModule.toNamespacedPath(path), uid, gid, req);
2012 * @param {string | Buffer | URL} path
2017 function lchownSync(path, uid, gid) {
2018 path = getValidatedPath(path);
2021 const ctx = { path };
2022 binding.lchown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);
2065 * @param {string | Buffer | URL} path
2071 function chown(path, uid, gid, callback) {
2073 path = getValidatedPath(path);
2079 binding.chown(pathModule.toNamespacedPath(path), uid, gid, req);
2085 * @param {string | Buffer | URL} path
2090 function chownSync(path, uid, gid) {
2091 path = getValidatedPath(path);
2094 const ctx = { path };
2095 binding.chown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);
2101 * referenced by `path`.
2102 * @param {string | Buffer | URL} path
2108 function utimes(path, atime, mtime, callback) {
2110 path = getValidatedPath(path);
2114 binding.utimes(pathModule.toNamespacedPath(path),
2122 * of the object referenced by `path`.
2123 * @param {string | Buffer | URL} path
2128 function utimesSync(path, atime, mtime) {
2129 path = getValidatedPath(path);
2130 const ctx = { path };
2131 binding.utimes(pathModule.toNamespacedPath(path),
2178 * @param {string | Buffer | URL} path
2184 function lutimes(path, atime, mtime, callback) {
2186 path = getValidatedPath(path);
2190 binding.lutimes(pathModule.toNamespacedPath(path),
2199 * @param {string | Buffer | URL} path
2204 function lutimesSync(path, atime, mtime) {
2205 path = getValidatedPath(path);
2206 const ctx = { path };
2207 binding.lutimes(pathModule.toNamespacedPath(path),
2252 * @param {string | Buffer | URL | number} path
2263 function writeFile(path, data, options, callback) {
2276 if (isFd(path)) {
2279 writeAll(path, isUserFd, data, 0, data.byteLength, signal, callback);
2286 fs.open(path, flag, options.mode, (openErr, fd) => {
2299 * @param {string | Buffer | URL | number} path
2308 function writeFileSync(path, data, options) {
2321 const isUserFd = isFd(path); // File descriptor ownership
2322 const fd = isUserFd ? path : fs.openSync(path, flag, options.mode);
2339 * @param {string | Buffer | URL | number} path
2349 function appendFile(path, data, options, callback) {
2357 if (!options.flag || isFd(path))
2360 fs.writeFile(path, data, options, callback);
2365 * @param {string | Buffer | URL | number} path
2374 function appendFileSync(path, data, options) {
2381 if (!options.flag || isFd(path))
2384 fs.writeFileSync(path, data, options);
2552 // Finds the next portion of a (partial) path, up to the next path delimiter
2598 // The partial path so far, including a trailing slash if any
2600 // The partial path without a trailing slash (except when pointing at a root)
2602 // The partial path scanned in the previous round, with slash
2611 const ctx = { path: base };
2617 // Walk down the path, swapping out linked path parts for their real
2653 const ctx = { path: base };
2676 const ctx = { path: base };
2697 const ctx = { path: base };
2710 * @param {string | Buffer | URL} path
2714 realpathSync.native = (path, options) => {
2716 path = getValidatedPath(path);
2717 const ctx = { path };
2718 const result = binding.realpath(pathModule.toNamespacedPath(path), options.encoding, undefined, ctx);
2750 // The partial path so far, including a trailing slash if any
2752 // The partial path without a trailing slash (except when pointing at a root)
2754 // The partial path scanned in the previous round, with slash
2771 // Walk down the path, swapping out linked path parts for their real
2774 // Stop if scanned past end of path
2808 // If not a symlink, skip to the next path part
2864 * @param {string | Buffer | URL} path
2872 realpath.native = (path, options, callback) => {
2875 path = getValidatedPath(path);
2878 return binding.realpath(pathModule.toNamespacedPath(path), options.encoding, req);
2898 let path;
2900 path = `${prefix}XXXXXX`;
2902 path = Buffer.concat([prefix, Buffer.from('XXXXXX')]);
2907 binding.mkdtemp(path, options.encoding, req);
2922 let path;
2924 path = `${prefix}XXXXXX`;
2926 path = Buffer.concat([prefix, Buffer.from('XXXXXX')]);
2929 const ctx = { path };
2930 const result = binding.mkdtemp(path, options.encoding,
2976 const ctx = { path: src, dest }; // non-prefixed
3034 * @param {string | Buffer | URL} path
3049 function createReadStream(path, options) {
3051 return new ReadStream(path, options);
3056 * @param {string | Buffer | URL} path
3069 function createWriteStream(path, options) {
3071 return new WriteStream(path, options);