{"action":"created","issue":{"url":"https://api.github.com/repos/maxogden/extract-zip/issues/7","labels_url":"https://api.github.com/repos/maxogden/extract-zip/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/maxogden/extract-zip/issues/7/comments","events_url":"https://api.github.com/repos/maxogden/extract-zip/issues/7/events","html_url":"https://github.com/maxogden/extract-zip/issues/7","id":106128217,"number":7,"title":"[BUG] Files created in readonly - Callback already called + write error on next write.","user":{"login":"LiamKarlMitchell","id":1968109,"avatar_url":"https://avatars.githubusercontent.com/u/1968109?v=3","gravatar_id":"","url":"https://api.github.com/users/LiamKarlMitchell","html_url":"https://github.com/LiamKarlMitchell","followers_url":"https://api.github.com/users/LiamKarlMitchell/followers","following_url":"https://api.github.com/users/LiamKarlMitchell/following{/other_user}","gists_url":"https://api.github.com/users/LiamKarlMitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/LiamKarlMitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiamKarlMitchell/subscriptions","organizations_url":"https://api.github.com/users/LiamKarlMitchell/orgs","repos_url":"https://api.github.com/users/LiamKarlMitchell/repos","events_url":"https://api.github.com/users/LiamKarlMitchell/events{/privacy}","received_events_url":"https://api.github.com/users/LiamKarlMitchell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-12T04:21:32Z","updated_at":"2015-09-12T14:57:39Z","closed_at":null,"body":"Please keep in mind that I am trying this on an older Node Webkit  0.12.0 on Windows XP, 7, 8, 10.\r\nSeems I have to use this version for windows XP support but its node version is higher than the required one for this module.\r\n\r\n```\r\nwrite error Objecterror: Errorcode: \"EPERM\"errno: -4048message: \"EPERM: operation not permitted, open 'E:\\TEST\\gfdsgasd\\TEST.txt'\"path: \"E:\\TEST\\gfdsgasd\\TEST.txt\"\r\n```\r\n\r\nMy zip file contains a text file that is it.\r\n\r\nThe odd thing is when I goto the file on disk it is there but empty (probably from a previous attempt)\r\nI deleted everything and ran again and it worked which indicates it can't overwrite existing files or directories.\r\n\r\nDOH Its creating the file in read only mode. When I zipped the file it was not read only so the permission is being incorrectly set on here.\r\n\r\nAh here is a fix\r\nLine 67-71 of extract-zip/index.js\r\n\r\n```\r\n// if no mode then use the default.\r\nif (mode === 0) {\r\n  if (isDir) mode = 0555\r\n  else mode = 0666 //mode = 0444 read only\r\n}\r\n```\r\n\r\nMaybe there should have a way to specify the default mode if none is set?\r\nAlthough if I am extracting a file from a ZIP I would kind of expect it to default to writable at least for my user and createWriteStream + other file write methods default to 0666 so I think that should be the default.\r\n\r\nWhat are your thoughts on this?\r\n\r\nSample code\r\n```\r\nextractZip(path, { dir: 'E:\\\\TEST' }, function(err) {\r\n\tconsole.log('extracted', err);\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/maxogden/extract-zip/issues/comments/139782697","html_url":"https://github.com/maxogden/extract-zip/issues/7#issuecomment-139782697","issue_url":"https://api.github.com/repos/maxogden/extract-zip/issues/7","id":139782697,"user":{"login":"maxogden","id":39759,"avatar_url":"https://avatars.githubusercontent.com/u/39759?v=3","gravatar_id":"","url":"https://api.github.com/users/maxogden","html_url":"https://github.com/maxogden","followers_url":"https://api.github.com/users/maxogden/followers","following_url":"https://api.github.com/users/maxogden/following{/other_user}","gists_url":"https://api.github.com/users/maxogden/gists{/gist_id}","starred_url":"https://api.github.com/users/maxogden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxogden/subscriptions","organizations_url":"https://api.github.com/users/maxogden/orgs","repos_url":"https://api.github.com/users/maxogden/repos","events_url":"https://api.github.com/users/maxogden/events{/privacy}","received_events_url":"https://api.github.com/users/maxogden/received_events","type":"User","site_admin":false},"created_at":"2015-09-12T14:57:39Z","updated_at":"2015-09-12T14:57:39Z","body":"I think a `defaultMode` option would be fine, it should be a 1 line addition to the code, and a mention in the readme"}}