| 39 | const { isPromise } = require('util/types'); |
| 40 | |
| 41 | function 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 | |
| 61 | function getStats(src, dest, opts) { |
| 62 | // TODO(@anonrig): Avoid making two stat calls. |