Obtaining a Blob from a DataURL
In certain scenarios, there is a need to transform arbitrary data into a Data URL using FileReader's readAsDataURL() method. However, can this Data URL be converted back into a Blob instance utilizing built-in browser APIs?
A solution has been proposed by a user named Matt:
Code Snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Note:
As mentioned in subsequent comments, BlobBuilder has become deprecated. Therefore, the code provided above is an updated version.
The above is the detailed content of Can You Convert a Data URL Back to a Blob in JavaScript Using Built-in APIs?. For more information, please follow other related articles on the PHP Chinese website!