1.21 gigawatts
1.21 gigawatts

Reputation: 17776

How to check if an object is of type Blob?

Is it possible to check if an object is of type Blob in JavaScript?

I'm getting the following error:

TypeError: Argument 1 of FileReader.readAsDataURL does not implement interface Blob.

Upvotes: 2

Views: 7578

Answers (1)

Dinesh undefined
Dinesh undefined

Reputation: 5546

using instanceof blob you can check.

var MyBlob = new Blob(['content'], {type : 'text/plain'});
console.log(MyBlob instanceof Blob) // true

Upvotes: 5

Related Questions