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

Support URL.createObjectURL #26

Closed JasonKoopmans closed 1 year ago

JasonKoopmans commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL

Implementing this API permits the creation of browser addressable urls for File and Blob.

These examples provide some tangible use cases.

https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications#example_using_object_urls_to_display_pdf

A drag is the need to also implement URL.revokeObjectURL which deallocates a url resource to refer to the object.
https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL

KristofferStrube commented 1 year ago

Hey @JasonKoopmans,

That sounds interesting. Especially how that relates to the lifetime of the reference to it. It is the plan to implement the entire File API in which these methods are defined. I will ensure that I update you when that is accomplished. 🙂

KristofferStrube commented 1 year ago

An update on this is that I have started the development of the FileAPI wrapper as its own project. Once that is more featureful and published to Nuget this package will be updated to use it. https://github.com/KristofferStrube/Blazor.FileAPI

KristofferStrube commented 1 year ago

This was implemented as a part of #28 and has been published in version 2.0.0 to NuGet.

From the Blazor.FileAPI package you can use the URLSerivce to call CreateObjectURLAsync with some Blob.