#Problem with using "copy" library - to copy files
8 messages · Page 1 of 1 (latest)
A library for this? It's native https://nodejs.org/api/fs.html#fspromisescopyfilesrc-dest-mode
I just need to do it in CLI cuz that's a part of a compilation
then use the operating systems built-in method. using a library is a mistake.
I've used an library for it instead of command for X-platform
Make your script accept command line arguments? https://nodejs.org/api/process.html#processargv
I made copyHtml.js: ```js
import fs from 'fs/promises';
await fs.copyFile('src/public/index.html', 'dist/public');
but it does some error even if I use admin: ```
node:internal/fs/promises:612
return await PromisePrototypeThen(
^
Error: EPERM: operation not permitted, copyfile 'C:\Users\Skeku\Desktop\Raidcord\raidcord\src\public\index.html' -> 'C:\Users\Skeku\Desktop\Raidcord\raidcord\dist\public'
at async Object.copyFile (node:internal/fs/promises:612:10)
at async file:///C:/Users/Skeku/Desktop/Raidcord/raidcord/compilation/copyHtml.js:3:1 {
errno: -4048,
code: 'EPERM',
syscall: 'copyfile',
path: 'C:\\Users\\Skeku\\Desktop\\Raidcord\\raidcord\\src\\public\\index.html',
dest: 'C:\\Users\\Skeku\\Desktop\\Raidcord\\raidcord\\dist\\public'
}
Node.js v21.2.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```
Give full destination path (including filename)