Categories
JavaScript Answers

How to convert ArrayBuffer to blob with JavaScript?

Spread the love

Sometimes, we want to convert ArrayBuffer to blob with JavaScript.

In this article, we’ll look at how to convert ArrayBuffer to blob with JavaScript.

How to convert ArrayBuffer to blob with JavaScript?

To convert ArrayBuffer to blob with JavaScript, we use the Blob constructor.

For instance, we write

const buffer = new ArrayBuffer(32);
const blob = new Blob([buffer]);

to create a Blob with the buffer by putting it in an array and using the array as the argument of Blob.

Conclusion

To convert ArrayBuffer to blob with JavaScript, we use the Blob constructor.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *