jprichardson / node-fs-extra

Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
MIT License
9.47k stars 772 forks source link

fs.cp coming to Node.js core #912

Open RyanZim opened 3 years ago

RyanZim commented 3 years ago

As per https://github.com/nodejs/node/pull/39372; Node.js is considering moving copy*() to fs core. This will create a naming conflict between our method and fs core when it's released. How do we want to handle this?

bcoe commented 3 years ago

we've since moved to fs.cp.

RyanZim commented 3 years ago

Closing as this won't be an issue with the current direction.

manidlou commented 3 years ago

I figured I could reopen this instead of creating a new issue :grin:

So another thing that we need to think about here at fs-extra is the options for copy method because considering latest changes on nodejs/node#39372 these are some differences between node core fs.cp() and fse.copy() options:

When nodejs/node#39372 gets landed in node core, we probably want to use it wherever is possible but as long as we support older node versions (without fs.cp()) we would fallback to our current (soon to be fallback) implementation (the same thing that we did for fs.copyFile()) and in that case we need to think about how we want to handle backwards compatibility when using fs.cp() and fse.copy() together.

RyanZim commented 3 years ago

fse.copy should retain its current options and defaults; but use fs.cp under the hood where possible. When fs.cp is supported everywhere, we should probably consider deprecating fse.copy, in favor of people using fs.cp directly; they can use the new options/defaults when they migrate there.

RyanZim commented 2 years ago

fs.cp is still experimental, so holding off actually porting.