Categories
JavaScript Answers

How to get the string from a blob with JavaScript?

Spread the love

Sometimes, we want to get the string from a blob with JavaScript.

In this article, we’ll look at how to get the string from a blob with JavaScript.

How to get the string from a blob with JavaScript?

To get the string from a blob with JavaScript, we can use the Response object’s text method.

For instance, we write

const text = await new Response(blob).text();

to create a new Response object from blob.

Then we call text to return a promise with the string converted from the blob.

And we get the resolve value of the promise with await.

Conclusion

To get the string from a blob with JavaScript, we can use the Response object’s text method.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.