Accept `Blob`s anywhere where a `Buffer` is currently accepted for writing
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.4k
- Merge medio
- 4g 3h
- PR unite (30g)
- 272
Descrizione
What is the problem this feature will solve?
Because Buffers aren't immutable, any time a Buffer is passed to something which will perform an asynchronous write, there is a concurrency hazard where the buffer could conceivably get modified before it gets a chance to be written. This can lead to bugs which are hard to track down. (I speak from experience.)
What is the feature you are proposing to solve the problem?
Anywhere where Buffer is currently accepted for a write operation, e.g. and perhaps most notably stream.Writable.write() and stream.Writable.end(), also make it acceptable to pass a Blob. Blobs are always immutable.
What alternatives have you considered?
Just keep using Buffers, mostly keep my fingers crossed, and sometimes make copies of Buffers as a safeguard.
(Note: It also makes sense to have a way to optionally have Blobs returned from readable streams, but I figure that'd be a different feature request.)
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 dai punti di ingresso Node.js stream.Writable.write() e stream.Writable.end(), quindi esamina le altre API che attualmente accettano Buffer per le scritture asincrone. Determina il comportamento richiesto di Blob e aggiorna l’implementazione, i test e la documentazione dell’API pertinenti affinché gli input Blob siano accettati in modo coerente senza modificare il comportamento del valore restituito da readable-stream.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- api, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100