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

Additional notes on releasing resources when using file streams #493

Merged
merged 9 commits into from
Oct 9, 2024
Next Next commit
Additional notes on releasing resources when using file streams
  • Loading branch information
fwqaaq authored Jun 9, 2024
commit 01d2b4154397a3aa06846d75a152592d932141c7
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>
fwqaaq marked this conversation as resolved.
Show resolved Hide resolved

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

## Deno.File
thisisjofrank marked this conversation as resolved.
Show resolved Hide resolved

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