Version
v24.14.0
Platform
Linux vali 6.18.7-76061807-generic #202601231045~1769703228~24.04~cb87b5b SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux
Subsystem
fs
What steps will reproduce the bug?
import { openAsBlob } from 'node:fs'
const result = await openAsBlob('does-not-exist').catch((error) => {})
console.log(result)
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
I expect openAsBlob() to always return a promise. If there are any problems, I expect the promise to be rejected.
What do you see instead?
Instead of returning a promise that’s rejected, openAsBlob() fails synchronously. This means that instead of using the Promise.catch() method, you have to use try/catch logic instead.
Additional information
Just marking the function as async on https://github.com/nodejs/node/blob/v25.8.1/lib/fs.js#L570 would fix it.
Version
v24.14.0
Platform
Subsystem
fsWhat steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
I expect
openAsBlob()to always return a promise. If there are any problems, I expect the promise to be rejected.What do you see instead?
Instead of returning a promise that’s rejected,
openAsBlob()fails synchronously. This means that instead of using thePromise.catch()method, you have to usetry/catchlogic instead.Additional information
Just marking the function as
asyncon https://github.com/nodejs/node/blob/v25.8.1/lib/fs.js#L570 would fix it.