-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs - add copyDirectory function #15797
Comments
It was only a matter of time... |
No such platform APIs exists for directories. |
I'm also in favor of doing this in userland. I'll close this out. |
@cjihrig, @mscdex Userland has got more potential for security vulnerabilities. The expectation with the node core is that it has had very thorough security and reliability testing and auditing. There is a lower level of confidence in packages in the npm ecosystem. While I understand that putting functionality such as this into the node core extends the surface area where things could go wrong in the core, since this was last discussed there have been some more npm/ecosystem problems, so thought that would be a reason to (try to) open this up for discussion again. Particularly with code that accesses the file system, it would be easier to ensure (or accurately judge) that a project's code is safe if it uses functionality in the node core rather than userland. There is also the issue of bloat within project dependencies, where overly simple functions (I know that's subjective) are required modules. I understand that the core developers are focused on not making a bloated node core, but by including more functionality within the core (with the code quality and overview standards that come with it), there is less space for some functionality which is repeated across a variety of applications to go wrong. |
@mscdex, @bnoordhuis , @coderaiser , @LinusU You treat(ed) having fairly basic, easy to use functionality that's likely to be needed by many applications within the node.js core as a joke. Node having some more features that securely performs copyDirectory and a few other things that would be obvious along the same lines of thinking would reduce reliance on userland modules and therefore improve security of node apps. Is this deemed any more important now compared to when I raised the issue? So what other issues are only a matter of time, and is it worth addressing them now? |
@metabench I'm very sorry that you feel like your request was joked about. Thanks for raising an improvement suggestion to Node.js core. Actually, the joke was not about your request - it was about anticipation that such a request would be made given copyFile was added and given we don't really explain the decision process very well. As Ben explained - the reason copyFile was added was because there are platform functions for that. If platforms (posix/windows) had native functions for copying directories like they have for copying files there is a good chance Node would add it. Node could certainly do a better job explaining our philosophy for adding features. I'd like to encourage you to get involved in areas you care about:
Again - thank you for caring, thank you for following up and I'm sorry that we haven't communicated things better. I'd like to remind you that most of us here are volunteers. |
@metabench, I totally agree with @benjamingr. About well-maintained packages with good quality and security, you can use copymitter I'm working on, it is used in web file manager, I'm working on as well, so any new |
A
copyFolder
alias would be useful to have. Thoughdirectory
was the original term and seems more technical, many coders are familiar with the termfolder
and it's quicker to type, and makes for slightly more compact source code.I suppose there are some difficulties with
fs.copyDirectory
as it was not included in 8.5.0 alongsidefs.copyFile
.I also suggest the option for keeping the original timestamps, like with the issue #15793, which applies to
fs.copyFile
.The text was updated successfully, but these errors were encountered: