Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect createReadStream() behavior with non-seekable streams #18129

Open
czkz opened this issue Mar 12, 2025 · 0 comments
Open

Incorrect createReadStream() behavior with non-seekable streams #18129

czkz opened this issue Mar 12, 2025 · 0 comments
Labels
bug Something isn't working node:fs

Comments

@czkz
Copy link

czkz commented Mar 12, 2025

What version of Bun is running?

1.2.5+013fdddc6

What platform is your computer?

Linux 6.12.16_1 x86_64 unknown

What steps can reproduce the bug?

Command in bash:

bun bug.mjs <(uname)

bug.mjs:

import { createReadStream } from "fs";

const input = createReadStream(process.argv[2]);
console.log((await input.toArray()).toString());

What is the expected behavior?

Same as node bug.mjs <(uname):

Linux

What do you see instead?

ESPIPE: invalid seek, read
      fd: 12,
 syscall: "read",
   errno: -29,
    code: "ESPIPE"

Additional information

node used: v20.16.0

alternative bug.mjs without toArray() - same behavior:

import * as readline from "readline";
import { createReadStream } from "fs";

const input = createReadStream(process.argv[2]);
const rl = readline.createInterface({ input });
for await (const line of rl) { console.log(line); }
@czkz czkz added bug Something isn't working needs triage labels Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node:fs
Projects
None yet
Development

No branches or pull requests

2 participants