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

Function cpSyncFn

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

Source from the content-addressed store, hash-verified

39const { isPromise } = require('util/types');
40
41function cpSyncFn(src, dest, opts) {
42 // Warn about using preserveTimestamps on 32-bit node
43 if (opts.preserveTimestamps && process.arch === 'ia32') {
44 const warning = 'Using the preserveTimestamps option in 32-bit ' +
45 'node is not recommended';
46 process.emitWarning(warning, 'TimestampPrecisionWarning');
47 }
48 if (opts.filter) {
49 const shouldCopy = opts.filter(src, dest);
50 if (isPromise(shouldCopy)) {
51 throw new ERR_INVALID_RETURN_VALUE('boolean', 'filter', shouldCopy);
52 }
53 if (!shouldCopy) return;
54 }
55
56 fsBinding.cpSyncCheckPaths(src, dest, opts.dereference, opts.recursive);
57
58 return getStats(src, dest, opts);
59}
60
61function getStats(src, dest, opts) {
62 // TODO(@anonrig): Avoid making two stat calls.

Callers 1

cpSyncFunction · 0.85

Calls 2

getStatsFunction · 0.70
filterMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…