Skip to content

Commit

Permalink
Refactor: Bun: use FileHandle.writeFile() (#1114)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm authored May 9, 2024
1 parent 7f59ca6 commit c32113f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/polyfill/fsPoly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ export default class FsPoly {

static async writeFile(
filePath: PathLike,
data: string | NodeJS.ArrayBufferView,
data: string | Uint8Array,
options?: ObjectEncodingOptions,
): Promise<void> {
const file = await fs.promises.open(filePath, 'w');
await fs.promises.writeFile(file, data, options);
await file.writeFile(data, options);
await file.sync(); // emulate fs.promises.writeFile() flush:true added in v21.0.0
await file.close();
}
Expand Down

0 comments on commit c32113f

Please sign in to comment.