Sometimes, we want to go from Blob to ArrayBuffer with JavaScript.
In this article, we’ll look at how to go from Blob to ArrayBuffer with JavaScript.
How to go from Blob to ArrayBuffer with JavaScript?
To go from Blob to ArrayBuffer with JavaScript, we can use the Response
constructor.
For instance, we write
const arrayBuffer = await new Response(blob).arrayBuffer();
to create a Response
object from blob
.
And then we call arraybuffer
to return a promise with the array buffer converted from the blob.
Conclusion
To go from Blob to ArrayBuffer with JavaScript, we can use the Response
constructor.