Uploading a large file in Blazor WASM without first loading it into memory

Viewed 42

It seems Blazor WASM will read all contents of an HttpClient.PostAsync request into memory before sending it, even when using StreamContent. This is bad for performance and memory.

Does anyone know of a way to solve this problem without having to introduce file-chunking on my server?

UPDATE The problem is in the dotnet runtime, here.

Uint8Array uint8Buffer = Uint8Array.From(await request.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: true)))

I'll see if I can work something out using XMLHttpRequest instead.

0 Answers
Related