Skip to content
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

Port File System APIs in Deno namespace to @std/fs #6255

Open
21 of 49 tasks
kt3k opened this issue Dec 12, 2024 · 6 comments
Open
21 of 49 tasks

Port File System APIs in Deno namespace to @std/fs #6255

kt3k opened this issue Dec 12, 2024 · 6 comments
Labels
enhancement New feature or request fs

Comments

@kt3k
Copy link
Member

kt3k commented Dec 12, 2024

We aim to make @std/fs cross-runtime (ref #4313). To achieve that we need to port FS APIs from Deno namespace (with Node.js compatibility)

Classes

  • FsFile

Functions

shim-deno package already implements Node.js compatible Deno APIs. We can borrow the code from there for the Node.js compatibility part https://github.com/denoland/node_shims/tree/main/packages/shim-deno

@kt3k kt3k added enhancement New feature or request fs labels Dec 12, 2024
@kt3k kt3k pinned this issue Dec 12, 2024
jbronder added a commit to jbronder/deno_std that referenced this issue Jan 8, 2025
jbronder added a commit to jbronder/deno_std that referenced this issue Jan 8, 2025
@eryue0220
Copy link
Contributor

Are unlink and unlinkSync ignored?

@kt3k
Copy link
Member Author

kt3k commented Feb 5, 2025

It looks like Deno doesn't have unlink and unlinkSync. Instead it has remove and removeSync. This list tries to mirror Deno FS APIs.

@eryue0220
Copy link
Contributor

Considering compatibility with Node, should fs.unlink and fs.unlinkSync also be provided?

@kt3k
Copy link
Member Author

kt3k commented Feb 6, 2025

Do you suggest unlink would be an alias to remove?

@eryue0220
Copy link
Contributor

Yes, except for compatibility, link and unlink is a pair, which is make more sense and more understandable than remove. WDYT?

@kt3k
Copy link
Member Author

kt3k commented Feb 6, 2025

Looked at the docs again, (Deno's) remove has an option like recursive (it can remove the entire directory), but unlink (of Node) doesn't. I feel unlink can't replace remove, and it feels like a limited version of remove.

BTW Node.js also has rm which is similar to Deno's remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fs
Projects
None yet
Development

No branches or pull requests

2 participants