-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Stabilize fs.cp(), fs.cpSync(), fsPromises.cp() methods #44598
Copy link
Copy link
Closed
Labels
experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.
Metadata
Metadata
Assignees
Labels
experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What is the problem this feature will solve?
Currently, these methods are marked as Experimental (Stability: 1):
fs.cp()fs.cpSync()fsPromises.cp()There were no major changes since their introduction in Node.js v16.7.0, so it should be safe to mark them Stable (Stability: 2) as per the Stability index.
If somehow, these methods are still not ready to be stable, this is a tracking issue/roadmap to know what are the needed TODOs before marking them as stable.
What is the feature you are proposing to solve the problem?
Marking
fs.cp(),fs.cpSync(),fsPromises.cp()methods as stable (Stability: 2).For automated test purposes, mocking
fsmodule is a must.Currently, the most used userland library for that is probably mock-fs, and doesn't support these methods.
Before marking this API stable, Node.js should provide the needed feature(s) for mocking this API in userland, or even better, include
mock-fsin Node.js core, this can be well suited with the newtest_runnermodule.Related issues: tschaub/mock-fs#358, #37746.
What alternatives have you considered?
I think it's best to avoid using experimental APIs, avoid warnings, and simply use features subject to semantic-versioning for easier Node.js upgrades.
The current workaround, I personally use and end up copy/pasting in several projects (too small to be an
npmpackage IMO):By marking this API as stable, I should be able to use it like this: