Skip to content

node:fs/promises has flawed readlines method #32678

@davidebombelli

Description

@davidebombelli

Version

deno 2.7.5 (stable, release, x86_64-unknown-linux-gnu)

v8 14.6.202.9-rusty

typescript 5.9.2

Steps to reproduce

  1. Create file test.js with the following content:
import { open } from 'node:fs/promises';

const fd = await open('README.md', 'r');

fd.readLines()

fd.close();
  1. Create a valid file.txt file in the same folder.
  2. Run the file like deno -A test.js.

Expected Behaviour

in Node.js, no output is printed and no error is thrown.

Actual Behaviour

error: Uncaught (in promise) BadResource: Bad resource ID
    at Module.read (ext:deno_io/12_io.js:48:28)
    at ext:deno_node/_fs/_fs_read.ts:82:26
    at Module.read (ext:deno_node/_fs/_fs_read.ts:88:5)
    at ext:deno_node/internal/fs/streams.mjs:234:8
    at new Promise (<anonymous>)
    at ReadStream._read (ext:deno_node/internal/fs/streams.mjs:232:9)
    at ReadStream.read (node:_stream_readable:617:12)
    at maybeReadMore_ (node:_stream_readable:756:12)
    at processTicksAndRejections (ext:core/01_core.js:378:17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions