New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base64 to Blob #510
Comments
You can do this yourself in JavaScript: See here. Not going to do this in our library because of the performance impact. |
When I tried method that you are mentioned. I'm run across an error called "res.blob() is not a function". Because of this error I can use this method: function urlToBlob(url) {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.onerror = reject;
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
resolve(xhr.response);
}
};
xhr.open('GET', url);
xhr.responseType = 'blob'; // convert type
xhr.send();
})
}
var data = 'data:image/png;base64,...';
urlToBlob(data)
.then(blob => {
console.log(blob)
}) |
Solution is not work without remote js debugging. |
FWIW React Native supports, although untested... you could try the following
|
Posted an example here, thanks @Johan-dutoit https://stackoverflow.com/a/59002760/1658268 |
Is it slower to use blob/byte arrays? I thought that was faster than base64 in most cases. What do you mean exactly by performance impact? |
I agree with you here. Blob should have less performance impact than base64 does. |
Is there anyway we can convert the base64 image from response.data to a bytes/blob?
The text was updated successfully, but these errors were encountered: