windows 11 22H2
[email protected]
When I execute
npx cpy-cli .\test.json foo\ --no-overwrite
it returns the error
Cannot copy from `test.json` to `d:\temp\foo\test.json`:
Cannot write to `d:\temp\foo\test.json`: EEXIST: file already exists, open 'd:\temp\foo\test.json'
Issuing the command without --no-overwrite works fine (but the file is overwritten)
when setting the --no-overwrite
parameter it should continue without error even if the file exists.
I found the test for cpy, it appears it is expected that overwrite:false will throw an exception? If so is there any way to 'skip/ignore' existing files similar to how the non async approach appears to work?
test('do not overwrite', async t => {
fs.mkdirSync(t.context.tmp);
fs.writeFileSync(path.join(t.context.tmp, 'license'), '');
await t.throwsAsync(cpy(['license'], t.context.tmp, {overwrite: false}));
t.is(read(t.context.tmp, 'license'), '');
});
EDIT: reading cp-file code, if I understand async copy overwrite false will throw an exception, but sync copy overwrite will not. If that is correct, then this was just a misunderstanding, please close the issue.
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