Categories
JavaScript Answers

How to create File object from Blob with JavaScript?

Spread the love

Sometimes, we want to create File object from Blob with JavaScript.

In this article, we’ll look at how to create File object from Blob with JavaScript.

How to create File object from Blob with JavaScript?

To create File object from Blob with JavaScript, we can use the File constructor`.

For instance, we write

const file = new File([blob], "filename");

to create a File object from a blob by putting it in an array.

The 2nd argument is a string with the file’s name.

Conclusion

To create File object from Blob with 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 *