Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix others
  • Loading branch information
Josh-Cena committed Nov 26, 2025
commit 4d7dac33c20be9c02e67195301e4fb9283300772
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This function reads a file (as a Node.js [`FileHandle`](https://nodejs.org/api/f
```js
async function readFileContents(path) {
await using disposer = new AsyncDisposableStack();
const handle = disposer.use(fs.open(path));
const handle = disposer.use(await fs.open(path));
const data = await handle.read();
return data;
// The disposer is disposed here, which causes handle to be closed too
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ for await (using reader of asyncIterableOfSyncDisposables) {
```

```js
const syncIterableOfAsyncDisposables = fs
.globSync("*.txt")
.map((path) => fs.open(path, "r"));
const syncIterableOfAsyncDisposables = await Promise.all(
fs.globSync("*.txt").map((path) => fs.open(path, "r")),
);
for (await using file of syncIterableOfAsyncDisposables) {
console.log(await file.read());
}
Expand Down