source: node_modules/@npmcli/fs/lib/cp/index.js@ 81bc7da

finki-main main
Last change on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 692 bytes
Line 
1const fs = require('../fs.js')
2const getOptions = require('../common/get-options.js')
3const node = require('../common/node.js')
4const polyfill = require('./polyfill.js')
5
6// node 16.7.0 added fs.cp
7const useNative = node.satisfies('>=16.7.0')
8
9const cp = async (src, dest, opts) => {
10 const options = getOptions(opts, {
11 copy: ['dereference', 'errorOnExist', 'filter', 'force', 'preserveTimestamps', 'recursive'],
12 })
13
14 // the polyfill is tested separately from this module, no need to hack
15 // process.version to try to trigger it just for coverage
16 // istanbul ignore next
17 return useNative
18 ? fs.cp(src, dest, options)
19 : polyfill(src, dest, options)
20}
21
22module.exports = cp
Note: See TracBrowser for help on using the repository browser.