0

I work on a Blazor webassembly project and I want to download a specific file from a distant url to the client local storage. Is there any way to do it?

1 Answers1

0

Taking into account what the local storage has been defined for : The Web Storage API provides mechanisms by which browsers can store key/value pairs, in a much more intuitive fashion than using cookies. It is not thought to hold on to files. It is more like a key/pair collection.

Right now, there is no easy way using native Blazor Wasm as far as I can see. You can use Blazored LocalStorage to store data, but it doesn't handle files.(It is currently not built with dotnet 6, but should be very soon.).

There have been creative ways to use the local storage to save a file. Using Javascript it can be achieved

(S.O.)How to save an image to localStorage and display it on the next page?

Saving images and files in localStorage

Shuryno
  • 532
  • 3
  • 13