diff options
author | cjihrig <cjihrig@gmail.com> | 2017-07-14 21:47:36 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-08-15 10:43:49 -0400 |
commit | 766d7e9c0b8eca53b864764b735682d814c56350 (patch) | |
tree | 4a1bb49a5113891a48d84b7b927f70f5c8023ff6 /docs/src | |
parent | ce56a85b19e13287d2613f8de33f479a9c1104b5 (diff) | |
download | libuv-766d7e9c0b8eca53b864764b735682d814c56350.tar.gz libuv-766d7e9c0b8eca53b864764b735682d814c56350.zip |
unix, windows: add basic uv_fs_copyfile()
Fixes: https://github.com/libuv/libuv/issues/925
PR-URL: https://github.com/libuv/libuv/pull/1465
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/fs.rst | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/docs/src/fs.rst b/docs/src/fs.rst index 3f766e39..2db915bc 100644 --- a/docs/src/fs.rst +++ b/docs/src/fs.rst @@ -92,7 +92,8 @@ Data types UV_FS_READLINK, UV_FS_CHOWN, UV_FS_FCHOWN, - UV_FS_REALPATH + UV_FS_REALPATH, + UV_FS_COPYFILE } uv_fs_type; .. c:type:: uv_dirent_t @@ -241,6 +242,22 @@ API Equivalent to :man:`ftruncate(2)`. +.. c:function:: int uv_fs_copyfile(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, int flags, uv_fs_cb cb) + + Copies a file from `path` to `new_path`. Supported `flags` are described below. + + - `UV_FS_COPYFILE_EXCL`: If present, `uv_fs_copyfile()` will fail with + `UV_EEXIST` if the destination path already exists. The default behavior + is to overwrite the destination if it exists. + + .. warning:: + If the destination path is created, but an error occurs while copying + the data, then the destination path is removed. There is a brief window + of time between closing and removing the file where another process + could access the file. + + .. versionadded:: 1.14.0 + .. c:function:: int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd, int64_t in_offset, size_t length, uv_fs_cb cb) Limited equivalent to :man:`sendfile(2)`. |