Fix typos in "Blob"
Fixed minor grammatical errors in **Blob** lesson in the chapter **Binary data, files**.
This commit is contained in:
parent
395462086c
commit
9f5d7bab56
1 changed files with 6 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
`Blob` # Blob
|
||||
# Blob
|
||||
|
||||
`ArrayBuffer` and views are a part of ECMA standard, a part of JavaScript.
|
||||
|
||||
|
@ -89,7 +89,7 @@ link.click();
|
|||
URL.revokeObjectURL(link.href);
|
||||
```
|
||||
|
||||
`URL.createObjectURL` takes a `Blob` and creates an unique URL for it, in the form `blob:<origin>/<uuid>`.
|
||||
`URL.createObjectURL` takes a `Blob` and creates a unique URL for it, in the form `blob:<origin>/<uuid>`.
|
||||
|
||||
That's what the value of `link.href` looks like:
|
||||
|
||||
|
@ -101,11 +101,11 @@ The browser for each URL generated by `URL.createObjectURL` stores an the URL ->
|
|||
|
||||
A generated URL (and hence the link with it) is only valid within the current document, while it's open. And it allows to reference the `Blob` in `<img>`, `<a>`, basically any other object that expects an url.
|
||||
|
||||
There's a side-effect though. While there's an mapping for a `Blob`, the `Blob` itself resides in the memory. The browser can't free it.
|
||||
There's a side-effect though. While there's a mapping for a `Blob`, the `Blob` itself resides in the memory. The browser can't free it.
|
||||
|
||||
The mapping is automatically cleared on document unload, so `Blob` o bjects are freed then. 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. But if an app is long-living, then that doesn't happen soon.
|
||||
|
||||
**So if we create an URL, that `Blob` will hang in memory, even if not needed any more.**
|
||||
**So if we create a URL, that `Blob` will hang in memory, even if not needed any more.**
|
||||
|
||||
`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.
|
||||
|
||||
|
@ -119,7 +119,7 @@ An alternative to `URL.createObjectURL` is to convert a `Blob` into a base64-enc
|
|||
|
||||
That encoding represents binary data as a string of ultra-safe "readable" characters with ASCII-codes from 0 to 64. And what's more important -- we can use this encoding in "data-urls".
|
||||
|
||||
A [data url](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) has the form `data:[<mediatype>][;base64],<data>`. We can use such urls everywhere, on a par with "regular" urls.
|
||||
A [data url](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) has the form `data:[<mediatype>][;base64],<data>`. We can use such urls everywhere, on par with "regular" urls.
|
||||
|
||||
For instance, here's a smiley:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue