disintegrator
Streaming large files with fetch and FormData
What would be ideal is if Deno did some duck typing where it checks that the value has the shape:
Note 1: I believe this can be an async iterable. In Node.js
stream
can be () => fs.createReadStream('./sample.txt')
(see: https://github.com/nodejs/undici/issues/2202#issuecomment-1664134203).37 replies
Streaming large files with fetch and FormData
This is the exact line: https://github.com/denoland/deno/blob/76a6ea57753be420398d3eba8f313a6c98eab8c3/ext/fetch/21_formdata.js#L110
37 replies
Streaming large files with fetch and FormData
The requirements are that you know the size of the stream ahead of time. So if you dig into some of the other implementations, they compute the file size and get a streaming handle to it and that all gets represented as a
File
(which inherits Blob).37 replies
Streaming large files with fetch and FormData
i thought that blob was the full file loaded into memoryIt doesn't have to be. In fact, in the browser when you select a file to upload with
<input type="file">
, that is not instantly read into memory. If it's used in a FormData as part of fetch on the client-side, the browser will stream it out.37 replies
Streaming large files with fetch and FormData
The Bun docs even call this out explicitly: https://bun.sh/docs/api/file-io#reading-files-bun-file
A BunFile represents a lazily-loaded file; initializing it does not actually read the file from disk.
...
The reference conforms to the Blob
interface, so the contents can be read in various formats.
37 replies