Skip to content

feat: FileSystem support for copyFile flags - #6885

Open
lika85456 wants to merge 1 commit into
Effect-TS:mainfrom
lika85456:feat/filesystem-copy-flags
Open

feat: FileSystem support for copyFile flags#6885
lika85456 wants to merge 1 commit into
Effect-TS:mainfrom
lika85456:feat/filesystem-copy-flags

Conversation

@lika85456

Copy link
Copy Markdown

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Support for FileSystem.copyFile mode flags:

  • COPYFILE_EXCL: Fail if the destination already exists.
  • COPYFILE_FICLONE: Attempt copy-on-write cloning, falling back to a regular copy.
  • COPYFILE_FICLONE_FORCE: Require copy-on-write cloning; fail if unsupported.

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

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Aug 2, 2026
@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5df29b3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
effect Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform-bun Major
@effect/platform-deno Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/vitest Major
@effect/ai-anthropic Major
@effect/ai-openai-compat Major
@effect/ai-openai Major
@effect/ai-openrouter Major
@effect/atom-react Major
@effect/atom-solid Major
@effect/atom-vue Major
@effect/sql-clickhouse Major
@effect/sql-d1 Major
@effect/sql-libsql Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-pglite Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-do Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/doctest Major
@effect/openapi-generator Major
@effect/docgen Major

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
basic.ts 6.65 KB 6.65 KB 0.00 KB (0.00%)
batching.ts 9.44 KB 9.44 KB 0.00 KB (0.00%)
brand.ts 6.33 KB 6.33 KB 0.00 KB (0.00%)
cache.ts 10.20 KB 10.20 KB 0.00 KB (0.00%)
config.ts 20.34 KB 20.34 KB 0.00 KB (0.00%)
differ.ts 19.95 KB 19.95 KB 0.00 KB (0.00%)
http-client.ts 21.04 KB 21.04 KB 0.00 KB (0.00%)
logger.ts 10.35 KB 10.35 KB 0.00 KB (0.00%)
metric.ts 8.58 KB 8.58 KB 0.00 KB (0.00%)
optic.ts 7.34 KB 7.34 KB 0.00 KB (0.00%)
pubsub.ts 14.49 KB 14.49 KB 0.00 KB (0.00%)
queue.ts 11.15 KB 11.15 KB 0.00 KB (0.00%)
schedule.ts 10.33 KB 10.33 KB 0.00 KB (0.00%)
schema-class.ts 18.88 KB 18.88 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 28.69 KB 28.69 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.01 KB 25.01 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.01 KB 13.01 KB 0.00 KB (0.00%)
schema-string.ts 10.66 KB 10.66 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.87 KB 14.87 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.67 KB 21.67 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.10 KB 24.10 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.93 KB 18.93 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.74 KB 18.74 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.61 KB 18.61 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.36 KB 22.36 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.28 KB 19.28 KB 0.00 KB (0.00%)
schema.ts 18.14 KB 18.14 KB 0.00 KB (0.00%)
stm.ts 12.13 KB 12.13 KB 0.00 KB (0.00%)
stream.ts 9.38 KB 9.38 KB 0.00 KB (0.00%)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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).

Pullfrog  | View workflow run | Using 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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to avoid adding options that are unsupported on some platforms.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 enhancement New feature or request

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

2 participants