promises.FileHandle.close - Node documentation
method promises.FileHandle.close

Usage in Deno

import { type promises } from "node:fs";
FileHandle.close(): Promise<void>

Closes the file handle after waiting for any pending operation on the handle to complete.

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.