source: node_modules/@npmcli/fs/lib/rm/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: 695 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 14.14.0 added fs.rm, which allows both the force and recursive options
7const useNative = node.satisfies('>=14.14.0')
8
9const rm = async (path, opts) => {
10 const options = getOptions(opts, {
11 copy: ['retryDelay', 'maxRetries', 'recursive', 'force'],
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.rm(path, options)
19 : polyfill(path, options)
20}
21
22module.exports = rm
Note: See TracBrowser for help on using the repository browser.