Open RyanZim opened 3 years ago
we've since moved to fs.cp
.
Closing as this won't be an issue with the current direction.
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:
recursive
option in fs.cp()
that is default to false
. In fs-extra
we copy the directory recursively by default.overwrite
option is renamed to force
in fs.cp()
.fs-extra
options param can be either an object or a function. In the case of a function, it will be passed as the filter function, but in node core fs.cp()
the options param is always an object.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.
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.
fs.cp
is still experimental, so holding off actually porting.
As per https://github.com/nodejs/node/pull/39372; Node.js is considering moving
copy*()
tofs
core. This will create a naming conflict between our method andfs
core when it's released. How do we want to handle this?