KristofferStrube / Blazor.FileSystemAccess

A Blazor wrapper for the File System Access browser API.
https://kristofferstrube.github.io/Blazor.FileSystemAccess/
MIT License
327 stars 39 forks source link

Large files rejected by SignalR when using Blazor Server #34

Closed janjanech closed 1 year ago

janjanech commented 1 year ago

Default setting for message size used by SignalR is 32768 and as such it is largest chunk of data possible to be transferred from JavaScript to Blazor Server app. It seems that this library is transferring whole file content in one chunk and attempt to load larger files ends with exception InvalidDataException: The maximum message size of 32768B was exceeded. This issue can be fixed by setting MaximumReceiveMessageSize option for SignalR, but it would be great if this library streams file content in chunks instead to enable opening files of unlimited size.

KristofferStrube commented 1 year ago

Hey Jan,

This is definitely a problem that I have faced before.

You can read more about it on the demo page/documentation for Blazor.FileAPI.

Another nice example of how to solve this is in the demo app of Blazor.Stream where we use CopyToAsync on the stream accessible from a File to copy in chunks.

Let me know if you want more info on this issue.