0

I have tried to convert blobs to image file using the below code.

var file = new File([blobs],"Download.png");

This gives me a file with type null

This is my file in console.

lastModified: 1618930293005
lastModifiedDate: Tue Apr 20 2021 07:51:33 GMT-0700 (Pacific Daylight Time) {}
name: "Download.png"
size: 3
type: ""
webkitRelativePath: ""

While I'm trying to download this file, it is downloading as a text file and not an image file. Can somebody help me with this?

I want to download the original file (i.e., Image file)

1

1 Answer 1

1

You can specify the type in the third parameter:

 new File([blobs], "Download.png", { type: "image/png" })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.