Commit Graph

13 Commits

Author SHA1 Message Date
jazelly
56e5bd8d2a
fs: use wstring on Windows paths
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/55171
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-10-18 09:07:57 +02:00
Jason Zhang
7fe5bcd29e
fs: check subdir correctly in cpSync
PR-URL: https://github.com/nodejs/node/pull/55033
Fixes: https://github.com/nodejs/node/issues/54285
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2024-09-28 13:50:53 +00:00
Jason Zhang
77ca5ca075 fs: convert to u8 string for filesystem path
PR-URL: https://github.com/nodejs/node/pull/54653
Fixes: https://github.com/nodejs/node/issues/54476
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-09-21 09:13:19 -07:00
Jason Zhang
c1afd2c8e3
fs: translate error code properly in cpSync
UV error code needs to be negative integer so it can be mapped
correctly. The filesystem error are positive integer, so we need to
handle it before throwing.

Co-authored-by: Jake Yuesong Li <jake.yuesong@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/54906
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2024-09-16 12:41:55 +00:00
Jason Zhang
a48852be17
fs: respect dereference when copy symlink directory
Co-authored-by: Jake Yuesong Li <jake.yuesong@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/54732
Fixes: https://github.com/nodejs/node/issues/54730
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-09-05 13:54:49 +00:00
Livia Medeiros
6a68794577
test: use tmpdir.resolve() in fs tests
PR-URL: https://github.com/nodejs/node/pull/49126
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-08-15 13:45:24 +00:00
Tetsuharu Ohzeki
12094bcb97
fs: add support for mode flag to specify the copy behavior
`fs.copyFile()` supports copy-on-write operation
if the underlying platform supports it by passing a mode flag.
This behavior was added in
a16d88d9e9.

This patch adds `mode` flag to `fs.cp()`, `fs.cpSync()`,
and `fsPromises.cp()` to allow to change their behaviors
to copy files.

This test case is based on the test case that was introduced
when we add `fs.constants.COPYFILE_FICLONE`.
a16d88d9e9.

This test strategy is:

- If the platform supports copy-on-write operation,
  check whether the destination is expected
- Otherwise, the operation will fail
  and check whether the failure error information is expected.

Fixes: https://github.com/nodejs/node/issues/47080
PR-URL: https://github.com/nodejs/node/pull/47084
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-04-20 06:28:18 +00:00
Livia Medeiros
b509e015ef
test: move socket from CWD to temporary directory
PR-URL: https://github.com/nodejs/node/pull/46863
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-03-01 11:06:39 +00:00
Tho
a14fc49570
fs: fix opts.filter issue in cpSync
PR-URL: https://github.com/nodejs/node/pull/45143
Fixes: https://github.com/nodejs/node/issues/44720
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-11-01 02:44:15 +00:00
Tho
5c9ea8aaf5
fs: fix opts.filter issue in cp async
PR-URL: https://github.com/nodejs/node/pull/44922
Fixes: https://github.com/nodejs/node/issues/44720
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-10-10 15:38:55 +00:00
Livia Medeiros
050d974a25
test: use common.mustNotMutateObjectDeep() in fs tests
PR-URL: https://github.com/nodejs/node/pull/43819
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-07-24 14:29:06 +01:00
Marcos Bjoerkelund
cee626d0f5
fs: support copy of relative links with cp and cpSync
Fixes: https://github.com/nodejs/node/issues/41693

PR-URL: https://github.com/nodejs/node/pull/41819
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-02-15 12:14:04 +00:00
bcoe
87d6fd7e69
fs: add recursive cp method
Introduces recursive cp method, based on fs-extra implementation.

PR-URL: https://github.com/nodejs/node/pull/39372
Fixes: https://github.com/nodejs/node/issues/35880
Refs: https://github.com/nodejs/tooling/issues/98
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ian Sutherland <ian@iansutherland.ca>
2021-08-11 19:53:32 -07:00