Skip to content

Exception when calling fs.close() without callback #30718

Description

@ben-stockett

Version: Deno 2.5.0

The Deno implementation of the Node file system API seems to require a callback.

But the callback should be optional according to the Node documentation:
https://nodejs.org/api/fs.html#fsclosefd-callback

Minimal example:

import * as fs from "node:fs";

const fd = fs.openSync("some_file", "r");
fs.close(fd);

Exception thrown:

error: Uncaught TypeError: callback is not a function
    at ext:deno_node/_fs/_fs_close.ts:17:5
    at callback (ext:deno_web/02_timers.js:58:7)
    at eventLoopTick (ext:core/01_core.js:214:13)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions