`openAsBlob` fails synchronously
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in lib/fs.js vicino all’implementazione di openAsBlob() alla riga indicata e riproduci il problema con l’esempio fornito di un percorso mancante. Controlla i test fs circostanti oppure aggiungi la copertura per il caso di errore. Il lavoro è completato quando openAsBlob() restituisce una promise e il percorso mancante viene segnalato tramite il rifiuto della promise invece di un lancio sincrono.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 78/100