Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function to override FileReader API object type property
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,
file = setFileType(file, 'application/octet-stream')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.