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

Function getStats

lib/internal/fs/cp/cp-sync.js:61–80  ·  view source on GitHub ↗
(src, dest, opts)

Source from the content-addressed store, hash-verified

59}
60
61function getStats(src, dest, opts) {
62 // TODO(@anonrig): Avoid making two stat calls.
63 const statSyncFn = opts.dereference ? statSync : lstatSync;
64 const srcStat = statSyncFn(src);
65 const destStat = statSyncFn(dest, { bigint: true, throwIfNoEntry: false });
66
67 if (srcStat.isDirectory() && opts.recursive) {
68 return onDir(srcStat, destStat, src, dest, opts);
69 } else if (srcStat.isFile() ||
70 srcStat.isCharacterDevice() ||
71 srcStat.isBlockDevice()) {
72 return onFile(srcStat, destStat, src, dest, opts);
73 } else if (srcStat.isSymbolicLink()) {
74 return onLink(destStat, src, dest, opts.verbatimSymlinks);
75 }
76
77 // It is not possible to get here because all possible cases are handled above.
78 const assert = require('internal/assert');
79 assert.fail('Unreachable code');
80}
81
82function onFile(srcStat, destStat, src, dest, opts) {
83 if (!destStat) return copyFile(srcStat, src, dest, opts);

Callers 2

cpSyncFnFunction · 0.70
copyDirFunction · 0.70

Calls 10

isCharacterDeviceMethod · 0.80
isBlockDeviceMethod · 0.80
onDirFunction · 0.70
onFileFunction · 0.70
onLinkFunction · 0.70
requireFunction · 0.50
isDirectoryMethod · 0.45
isFileMethod · 0.45
isSymbolicLinkMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…