-
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
Provide a way to create clone/CoW copies #12902
Comments
Likely needs libuv implementation. Related: libuv/libuv#925 |
Also see some of the attempts at using native copy calls in Yarn: yarnpkg/yarn#3290 which uses https://github.com/sciolist/fcopy (Unix via a native module) |
|
FWIW, CoW is not supported yet. There is a PR to add it to libuv but I haven't landed it yet because I have yet to see it work on any of the CI machines. |
Let's keep this open then. |
Ponyfill fs-copy-file can be used for copying files. In |
@coderaiser - That looks like a useful module. Although, technically that's not a ponyfill as ponyfills never use the native API (as per the document you linked to) 😃 |
Forgot to link it, but this is closed in a16d88d. |
Currently, copying files is implemented by reading the data of the source file and writing it to the new file, see fs-extra's implementation of copy. The problem is that this approach doesn't allow the OS to optimize file copying (such as by using direct disk-to-disk copy if it's available), nor does it allow the (optional or by default) use of reflink/CoW.
I'm specifically interested in making CoW (which is already available on some *nix file systems, including btrfs and zfs) available to nodejs.
IMHO, nodejs should add an fs.copy function (just like what fs-extra already does) which is implemented using the OS native file copying syscall. It should have an optional
option
parameter that allows specifying the copy should use CoW (if available), just like howcp --reflink=auto
from coreutils works on Linux.Note that this would be particularly benefit for cases where files are copied often - particularly big files. I'm thinking that this improvement would substantially benefit package managers (npm, yarn, etc).
The text was updated successfully, but these errors were encountered: