Categories
JavaScript Answers

How to convert Blob to File in JavaScript?

Spread the love

Sometimes, we want to convert Blob to File in JavaScript.

In this article, we’ll look at how to convert Blob to File in JavaScript.

How to convert Blob to File in JavaScript?

To convert Blob to File in JavaScript, we can use the File constructor.

For instance, we write

const file = new File([myBlob], "name");

to create a File object with the myBlob blob object in the array.

The 2nd argument is the file name string.

Conclusion

To convert Blob to File in JavaScript, we can use the File 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 *