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

Open a file/folder with exclusive lock #54446

Closed
cangSDARM opened this issue Aug 19, 2024 · 1 comment
Closed

Open a file/folder with exclusive lock #54446

cangSDARM opened this issue Aug 19, 2024 · 1 comment
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@cangSDARM
Copy link

What is the problem this feature will solve?

Prevents other processes from opening a file or device if they request delete, read, or write access.

https://stackoverflow.com/questions/66728960/how-to-open-a-file-with-exclusive-file-access-in-node

windows: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
also in unix: https://man7.org/linux/man-pages/man2/flock.2.html

so it should be consider as a well-supported API, yet node (native api) doesn't implemented.

What is the feature you are proposing to solve the problem?

add a api like fd.lock() or fs.lock(fd)

What alternatives have you considered?

outdated package like https://github.com/baudehlo/node-fs-ext

@cangSDARM cangSDARM added the feature request Issues that request new features to be added to Node.js. label Aug 19, 2024
@bnoordhuis
Copy link
Member

Duplicate of #49256, #122 (from 2014!) and probably many others. Long story short: not going to happen because irredeemably unsafe and irreparably broken. Read through the linked issues for more details and discussion.

@bnoordhuis bnoordhuis closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

2 participants