Javascript has both File and Blob for file representation, and both are almost the same thing. Is there a way to check if a variable is holding a File or a Blob type of data?
File
Blob
Easiest way:
a = new File([1,2,3], "file.txt"); b = new Blob([1,2,3]); c = "something else entirely"; a instanceof File > true b instanceof File > false c instanceof File > false
2.1m questions
2.1m answers
60 comments
57.0k users