Open emmercm opened 1 week ago
1.1.7+b0b7db5c0
Darwin 23.4.0 arm64 arm
Run this JavaScript:
import fs from 'node:fs'; (async (): Promise<void> => { const file = await fs.promises.open('dummy.txt', 'w'); await fs.promises.writeFile(file, 'data'); await file.close(); })();
This is valid code for writing files with Node.js, so I'm hoping it can be supported with Bun.
1 | import fs from 'node:fs'; 2 | 3 | (async (): Promise<void> => { 4 | const file = await fs.promises.open('dummy.txt', 'w'); 5 | await fs.promises.writeFile(file, 'data'); ^ TypeError: path must be a string or a file descriptor code: "ERR_INVALID_ARG_TYPE" at /Users/cemmer/Resilio Sync/Development/igir/dummy.ts:5:9 Bun v1.1.7 (macOS arm64)
fs.promises.FileHandle.writeFile() appears to work fine with Bun:
fs.promises.FileHandle.writeFile()
import fs from 'node:fs'; (async (): Promise<void> => { const file = await fs.promises.open('dummy.txt', 'w'); await file.writeFile('data'); await file.close(); })();
What version of Bun is running?
1.1.7+b0b7db5c0
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
Run this JavaScript:
What is the expected behavior?
This is valid code for writing files with Node.js, so I'm hoping it can be supported with Bun.
What do you see instead?
Additional information
fs.promises.FileHandle.writeFile()
appears to work fine with Bun: