fs.copyFile has landed with Node.js 8.5.0. You should consider using it for copying files when/where applicable.
@benjamingr Thanks for bringing this up. Man, I'm so happy to have this in core. :tada:
One question I have: How does copyFile handle symlinks?
Todo list:
copy & copySync, still falling back to our methods in older envs. @manidlou Let's do this after your changes are merged. This should definitely be semver-major; there will probably be os-specific stuff to work-around.Self-assigning for now to get the ball rolling, may ask others to help later though.
One question I have: How does copyFile handle symlinks?
@RyanZim I tested when src is a symlink, and copyFile() creates a regular file for dest.
I'm looking at this project as a way to preserve timestamps while copying files (in Windows), but have run into the EPERM error while copying symlinks. Please be wary of using another method that copies the symlinks but does not preserve timestamps if it's an option to do so.
@manidlou Do you want to work on using copyFile where it's supported, falling back to our current implementation in older versions of Node? The work should be based against the develop branch.
@manidlou Do you want to work on using copyFile where it's supported, falling back to our current implementation in older versions of Node? The work should be based against the develop branch.
Sure thing. I'll work on it.
PR done for copy: #505
@manidlou We also need to use fs.copyFileSync in copySync when possible.
@manidlou We also need to use fs.copyFileSync in copySync when possible.
That's right! I am working on it.
It's just copySync needs serious cleanup (its implementation is not consistent with new changes that we applied to copy), and I am willing to work on it. But, I think it's better to add the native fs.copyFileSync first, then work on other parts of it! let me know if there is any objections!
PR updated for copySync: #505.
OK, I think everything that needs done here is done in develop; closing out for now; will be released in the next major version.
@RyanZim By any chance, do you have an idea when the next version will be released? The copy rewrite listed in the 5.0.0 milestones seems to have been merged in #502, so is "cannot copy a directory within itself" the last missing part?
@arcanis AFAIK, everything's ready for the release, I'd have to double-check. I've just been too busy to release it. I'll try to hit it soon, though it doesn't suit me tonight. Ping me if I don't have 5.0.0 out within a week.
Most helpful comment
@benjamingr Thanks for bringing this up. Man, I'm so happy to have this in core. :tada:
One question I have: How does
copyFilehandle symlinks?Todo list:
copy©Sync, still falling back to our methods in older envs. @manidlou Let's do this after your changes are merged. This should definitely be semver-major; there will probably be os-specific stuff to work-around.