mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
Fix fd offset handling in ReadStream (#10883)
Co-authored-by: Georgijs Vilums <=> Co-authored-by: gvilums <gvilums@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
@@ -1815,6 +1815,24 @@ describe("createReadStream", () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it(
|
||||
"correctly handles file descriptors with an offset",
|
||||
done => {
|
||||
const path = `${tmpdir()}/bun-fs-createReadStream-${Date.now()}.txt`;
|
||||
const fd = fs.openSync(path, "w+");
|
||||
|
||||
const stream = fs.createReadStream("", { fd: fd, start: 2 });
|
||||
stream.on("data", chunk => {
|
||||
expect(chunk.toString()).toBe("llo, world!");
|
||||
done();
|
||||
});
|
||||
stream.on("error", done);
|
||||
|
||||
fs.writeSync(fd, "Hello, world!");
|
||||
},
|
||||
{ timeout: 100 },
|
||||
);
|
||||
});
|
||||
|
||||
describe("fs.WriteStream", () => {
|
||||
|
||||
Reference in New Issue
Block a user