EsenteE
Denoβ€’3y agoβ€’
5 replies
Esente

Streaming FormData

I have Deno.serve a HTML page with <form enctype="multipart/form-data"> with a
file
input.

I also have a handler for POST that would take that
File
, split it, and sends the chunks to another endpoint.

What I have so far in the POST handler is to await request.formData() to retrieve the File from there and split.

It works fine for small files, but for big file, the handler would wait until the whole file is sent before starting to split, which can overflow the memory.

Is there a way that I can immediately stream the File from the browser's request, and split it as more data come in?
Was this page helpful?