const cpfile = require('cp-file');
const path = require('path')
const src = path.resolve(__dirname, './index.js');
const dest = "D:\\"
cpfile(src, dest, {
}).on('progress', (process) => console.log(process)).then(done => console.log({done}))
.catch(e => console.log(e));
stack:
$ node index.js
{ NestedError: Cannot create directory D:\
: EPERM: operation not permitted, mkdir 'D:'
at makeDir.catch.error (d:\code\tset\node_modules\cp-file\fs.js:82:8)
Caused By: Error: EPERM: operation not permitted, mkdir 'D:'
nested:
{ Error: EPERM: operation not permitted, mkdir 'D:' errno: -4048, code: 'EPERM', syscall: 'mkdir', path: 'D:\' },
errno: -4048,
code: 'EPERM',
syscall: 'mkdir',
path: 'D:\',
name: 'CpFileError' }
I found that it was 'make-dir' cause error
mkdir
On Windows, using fs.mkdir() on the root directory even with recursion will result in an error:
fs.mkdir('/', { recursive: true }, (err) => {
// => [Error: EPERM: operation not permitted, mkdir 'C:\']
});
@sindresorhus help plz !!!
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too