yeposa.blogg.se

How to convert a file to a url link
How to convert a file to a url link






URL.revokeObjectURL(url) removes the reference from the internal mapping, thus allowing the Blob to be deleted (if there are no other references), and the memory to be freed.

how to convert a file to a url link

So if we create a URL, that Blob will hang in memory, even if not needed any more. But if an app is long-living, then that doesn’t happen soon. The mapping is automatically cleared on document unload, so Blob objects are freed then. While there’s a mapping for a Blob, the Blob itself resides in the memory. And it allows to reference the Blob in, , basically any other object that expects a URL. So such URLs are short, but allow to access the Blob.Ī generated URL (and hence the link with it) is only valid within the current document, while it’s open.

how to convert a file to a url link

For each URL generated by URL.createObjectURL the browser stores a URL → Blob mapping internally.








How to convert a file to a url link