{"action":"opened","issue":{"url":"https://api.github.com/repos/markmarijnissen/cordova-promise-fs/issues/10","labels_url":"https://api.github.com/repos/markmarijnissen/cordova-promise-fs/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/markmarijnissen/cordova-promise-fs/issues/10/comments","events_url":"https://api.github.com/repos/markmarijnissen/cordova-promise-fs/issues/10/events","html_url":"https://github.com/markmarijnissen/cordova-promise-fs/issues/10","id":86238808,"number":10,"title":"new Blob() - Illegal constructor","user":{"login":"pheinicke","id":7060709,"avatar_url":"https://avatars.githubusercontent.com/u/7060709?v=3","gravatar_id":"","url":"https://api.github.com/users/pheinicke","html_url":"https://github.com/pheinicke","followers_url":"https://api.github.com/users/pheinicke/followers","following_url":"https://api.github.com/users/pheinicke/following{/other_user}","gists_url":"https://api.github.com/users/pheinicke/gists{/gist_id}","starred_url":"https://api.github.com/users/pheinicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pheinicke/subscriptions","organizations_url":"https://api.github.com/users/pheinicke/orgs","repos_url":"https://api.github.com/users/pheinicke/repos","events_url":"https://api.github.com/users/pheinicke/events{/privacy}","received_events_url":"https://api.github.com/users/pheinicke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-08T16:12:59Z","updated_at":"2015-06-08T16:12:59Z","closed_at":null,"body":"Hi!\r\n\r\nIn certain Android versions (e.g. 4.3) the blob constructor does not work. Using the constructor, an error is thrown: \"TypeError: Illegal constructor\".\r\n\r\nWe use cordova-promise-fs in combination with cordova-app-loader, and sometimes on our Android 4.3 test device, the update failes because the blob constructor is used.\r\n\r\nThe problematic part of the code is the following:\r\n\r\n```javascript\r\n  /* write contents to a file */\r\n  function write(path,blob,mimeType) {\r\n    return ensure(dirname(path))\r\n      .then(function() { return file(path,{create:true}); })\r\n      .then(function(fileEntry) {\r\n        return new Promise(function(resolve,reject){\r\n          fileEntry.createWriter(function(writer){\r\n            writer.onwriteend = resolve;\r\n            writer.onerror = reject;\r\n            if(typeof blob === 'string') {\r\n              blob = new Blob([blob],{type: mimeType || 'text/plain'});\r\n            } else if(blob instanceof Blob !== true){\r\n              blob = new Blob([JSON.stringify(blob,null,4)],{type: mimeType || 'application/json'});\r\n            }\r\n            writer.write(blob);\r\n          },reject);\r\n        });\r\n      });\r\n    }\r\n```\r\n\r\nThough deprecated, the BlobBuilder should be used if creating the Blob via constructor fails. See https://developer.mozilla.org/en-US/docs/Web/API/BlobBuilder\r\n\r\nI'll try to create a pull request in the next days..."}}