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

fs.readFileSync doesn't use the w+ flag #15418

Open
valhalla-nc opened this issue Nov 26, 2024 · 0 comments
Open

fs.readFileSync doesn't use the w+ flag #15418

valhalla-nc opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working confirmed bug We can reproduce this issue node:fs

Comments

@valhalla-nc
Copy link

valhalla-nc commented Nov 26, 2024

What version of Bun is running?

v1.1.37

What platform is your computer?

Linux 6.6.62 x86_64

What steps can reproduce the bug?

  1. file test.mjs content
import fs from "fs";
fs.readFileSync("data.txt", { encoding: "utf8", flag: "w+" })
  1. bun test.mjs
  2. make sure data.txt doesn't exist

What is the expected behavior?

run node test.mjs

<no output>

created a new file data.txt in the current directory.

What do you see instead?

error and no file created

1 | import fs from "fs";
2 | fs.readFileSync("data.txt", { encoding: "utf8", flag: "w+" })
       ^
ENOENT: No such file or directory
   errno: -2
 syscall: "open"
   path: "data.txt"

Additional information

No response

@valhalla-nc valhalla-nc added bug Something isn't working needs triage labels Nov 26, 2024
@RiskyMH RiskyMH added node:fs confirmed bug We can reproduce this issue and removed needs triage labels Nov 26, 2024
@RiskyMH RiskyMH changed the title fs.readFileSync doesn't use the flag fs.readFileSync doesn't use the w+ flag Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed bug We can reproduce this issue node:fs
Projects
None yet
Development

No branches or pull requests

2 participants