2

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.

1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231

1 Answers1

4

using instanceof blob you can check.

var MyBlob = new Blob(['content'], {type : 'text/plain'});
console.log(MyBlob instanceof Blob) // true
Dinesh undefined
  • 5,490
  • 2
  • 19
  • 40