fs.copyFileSync and fs/promises.copyFile hangs #4975
Unanswered
Zain-ul-din
asked this question in
Q&A
Replies: 0 comments 17 replies
-
You can use const fse = require('fs-extra');
const srcDir = `path/to/file`;
const destDir = `path/to/destination/directory`;
// To copy a folder or file
const opts = {}; //{ overwrite: true } if you want to replace existing folder or file with same name
fse.copySync(srcDir, destDir, opts, function (err) {
if (err) {
console.error(err);
} else {
console.log("success!");
}
}); Another way is using native utils like unix command |
Beta Was this translation helpful? Give feedback.
16 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Node Js Version : v16.16.0
Plateform : Window
Hey, I'm using node js to copy and paste files from one folder to another but, whenever I tried to copy a large number of files it hangs can you help me to solve this issue?
Here is the code I'm using I am pretty sure about the path is correct and also I'm not getting any error in the console.
Beta Was this translation helpful? Give feedback.
All reactions