closeAsync

abstract fun closeAsync(): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>(source)

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();
}

Since

v10.0.0

Return

Fulfills with undefined upon success.