Closed
Description
Version
v18.12.1
Platform
Linux ubuntu-focal 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
const fs = require("fs/promises");
async function test() {
let path = '/path/to/file';
let buf = Buffer.alloc(4);
let handle;
try {
handle = await fs.open(path);
{
let buf = Buffer.alloc(4);
let { bytesRead, buffer } = await handle.read(buf);
//let { bytesRead, buffer } = await handle.read(buf, {}); // It is behavior I would expect.
console.log(bytesRead);
console.log(buffer);
console.log(buf);
}
} finally {
await handle?.close();
}
}
test();
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
https://nodejs.org/dist/latest-v18.x/docs/api/fs.html#filehandlereadbuffer-options
Even if you omit options
, it will be default values.
What do you see instead?
0
<Buffer 00 00 00 00>
<Buffer 00 00 00 00>
Additional information
No response