finki-main
main
|
Last change
on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
692 bytes
|
| Line | |
|---|
| 1 | const fs = require('../fs.js')
|
|---|
| 2 | const getOptions = require('../common/get-options.js')
|
|---|
| 3 | const node = require('../common/node.js')
|
|---|
| 4 | const polyfill = require('./polyfill.js')
|
|---|
| 5 |
|
|---|
| 6 | // node 16.7.0 added fs.cp
|
|---|
| 7 | const useNative = node.satisfies('>=16.7.0')
|
|---|
| 8 |
|
|---|
| 9 | const 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 |
|
|---|
| 22 | module.exports = cp
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.