feat: FileSystem support for copyFile flags - #6885
Conversation
🦋 Changeset detectedLatest commit: 5df29b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — adds CopyFileFlag constants and an optional mode option to FileSystem.copyFile, with platform-specific implementations for Node (passthrough to fs.copyFile) and Deno (rejects unsupported flags, silently falls through for COPYFILE_FICLONE).
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
| const copyFile: FileSystem.FileSystem["copyFile"] = (fromPath, toPath, options) => { | ||
| const mode = options?.mode ?? 0 | ||
| const { COPYFILE_EXCL, COPYFILE_FICLONE_FORCE } = FileSystem.CopyFileFlag | ||
| if ((mode & COPYFILE_EXCL) !== 0 || (mode & COPYFILE_FICLONE_FORCE) !== 0) { |
There was a problem hiding this comment.
We want to avoid adding options that are unsupported on some platforms.
There was a problem hiding this comment.
Why is DenoFileSystem not implemented with NodeFileSystem like BunFileSystem? node:fs has the interface for these flags and Deno also implements it - however not correctly (EXCL is not atomic and COPYFILEs ignored).

Type
Description
Support for FileSystem.copyFile mode flags:
Node and Bun implementations already support this, I just added the mode.
Deno however doesn't seem to support these flags, so my current implementation for Deno fails on the EXCL and FICLONE_FORCE flags, on FICLONE it does nothing.
Related