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.