fs.copyFileSync and fs/promises.copyFile hangs #44369
Unanswered
Zain-ul-din
asked this question in
General
Replies: 1 comment 16 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
-
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