Skip to content

Commit

Permalink
Additional notes on releasing resources when using file streams
Browse files Browse the repository at this point in the history
  • Loading branch information
fwqaaq authored Jun 9, 2024
1 parent 558eb18 commit 01d2b41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/api/runtime-fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ async function handler(_req) {
Deno.serve(handler);
```

> Note: when you iterate over a file stream as shown below, the file descriptor will be automatically closed at the end of iteration. So, there is no need to manually close the file descriptor.
>
> See: <https://github.com/denoland/deno/issues/23481>

```ts
const iterator = fd.readable[Symbol.asyncIterator]();
```

## Deno.File

`Deno.File` is a file handle returned from [`Deno.open()`](#denoopen). It can be
Expand Down

0 comments on commit 01d2b41

Please sign in to comment.