Copy folder recursively in Node.js

lostsource picture lostsource · Dec 9, 2012 · Viewed 181.7k times · Source

Is there an easier way to copy a folder and all its content without manually doing a sequence of fs.readir, fs.readfile, fs.writefile recursively?

I am just wondering if I'm missing a function which would ideally work like this:

fs.copy("/path/to/source/folder", "/path/to/destination/folder");

Answer

shift66 picture shift66 · Dec 9, 2012

You can use the ncp module. I think this is what you need.