Last active
May 26, 2017 08:33
-
-
Save gonzalo-trenco/19c62ce08a135feacb800d70983797d2 to your computer and use it in GitHub Desktop.
function to override FileReader API object type property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setFileType(file, type) { | |
Object.defineProperties(file, { | |
'type': { | |
writable: true | |
} | |
}); | |
file.type = type; | |
return file; | |
} | |
// Parsed File from FileReader API | |
var file = { | |
name: "2698bfcb870313a0c10df3e5af71666e.custom", | |
lastModified: 1486767600000, | |
lastModifiedDate: Sat Feb 11 2017 00:00:00 GMT+0100 (CET), | |
webkitRelativePath: "", | |
size: 63807, | |
type:"", | |
webkitRelativePath:"" | |
}; | |
file = setFileType(file, 'application/octet-stream') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment