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`.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.