Skip to main content
FileHandle.close - node__fs--promises.d.ts - Node documentation
method FileHandle.close

Usage in Deno

```typescript import { type FileHandle } from "node:node__fs--promises.d.ts"; ```
FileHandle.close(): Promise<void>
Closes the file handle after waiting for any pending operation on the handle to complete. ```js import { open } from 'node:fs/promises'; let filehandle; try { filehandle = await open('thefile.txt', 'r'); } finally { await filehandle?.close(); } ```

Return Type

Promise<void>
Fulfills with `undefined` upon success.