Sync alternative to `fs.openAsBlob`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
What is the problem this feature will solve?
I'm making a cross-runtime file streaming library (that needs to be fast) and this would make it way easier to do so since Bun.file() is already sync.
So the code might look like this if my suggestion made it to node:fs:
const getFile: (path: string) => File = globalThis.Bun
? Bun.file
: process.getBuiltinModule('fs').openAsWebFile;
// Usage
return new Response(getFile('./index.html'));
return new Response(getFile('./binary-data').slice(0, 100));
What is the feature you are proposing to solve the problem?
A new API, something like fs.openAsWebFile() that returns a File maybe?
It would have more info for the Response constructor to pick up as well.
What alternatives have you considered?
fs.createReadStream but that is also async and can be slower too.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Überprüfung der vorhandenen fs.openAsBlob- und fs.createReadStream-APIs und ihrer Dokumentation. Kläre den Aufbau der synchronen File API, die für Response zugänglichen Metadaten und das Verhalten über verschiedene Runtimes hinweg, bevor du einen Einstiegspunkt vorschlägst. Als abgeschlossen gilt die Arbeit, wenn das API-Design abgestimmt ist und sein Verhalten durch Tests und Dokumentation abgedeckt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- backend
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100