Open controversial opened 1 year ago
This isnt a bug with large files but the fact of using a Readable at all, though fs.createReadStream is exempt from this:
import { Readable } from "stream";
import readline from "readline";
const readable = new Readable({
read() {
this.push("hello world\n");
this.push("hello world\n");
this.push(null);
},
});
const rl = readline.createInterface({
input: readable,
crlfDelay: Infinity,
});
rl.on("line", (line) => {
console.log({ line });
});
I thought I’d tested it and been able to successfully use Readable on smaller files, but now I can’t remember for sure
that's interesting. i get the same error you have so unsure if things changed or not
I am also having this problem on a small 1.8kb text file.
What version of Bun is running?
0.6.0 (latest canary)
What platform is your computer?
Darwin 22.4.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
Readline object is created successfully
What do you see instead?
A TypeError
undefined is not an object (evaluating 'this[kDecoder].write')
is logged to the console from insidenode:readline
literally thousands of times (in my test, 20k+ lines of output):Additional information
This error reproduces on a large (~18MB) file for me, but not on a small (~2KB) file.
Using
fs.createReadStream(path)
instead ofReadable.fromWeb(Bun.file(path).stream())
, this error does not appear.