javascript has both file , blob file representation, , both same thing. there way check if variable holding file or blob type of data?
w3.org:
'a file object blob object name attribute, string;'
in case of file:
var d = new date(2013, 12, 5, 16, 23, 45, 600); var generatedfile = new file(["rough draft ...."], "draft1.txt", {type: 'text/plain', lastmodified: d}); console.log(typeof generatedfile.name == 'string'); // true in case of blob:
var blob = new blob(); console.log(typeof blob.name); // undefined condition:
var isfile = typeof fileorblob.name == 'string';
Comments
Post a Comment