{"action":"created","issue":{"url":"https://api.github.com/repos/jxcore/jxcore/issues/242","labels_url":"https://api.github.com/repos/jxcore/jxcore/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/jxcore/jxcore/issues/242/comments","events_url":"https://api.github.com/repos/jxcore/jxcore/issues/242/events","html_url":"https://github.com/jxcore/jxcore/issues/242","id":62461054,"number":242,"title":"SM: stats result of fs.stat(Sync) is a function instead of an object","user":{"login":"ktrzeciaknubisa","id":5946844,"avatar_url":"https://avatars.githubusercontent.com/u/5946844?v=3","gravatar_id":"","url":"https://api.github.com/users/ktrzeciaknubisa","html_url":"https://github.com/ktrzeciaknubisa","followers_url":"https://api.github.com/users/ktrzeciaknubisa/followers","following_url":"https://api.github.com/users/ktrzeciaknubisa/following{/other_user}","gists_url":"https://api.github.com/users/ktrzeciaknubisa/gists{/gist_id}","starred_url":"https://api.github.com/users/ktrzeciaknubisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktrzeciaknubisa/subscriptions","organizations_url":"https://api.github.com/users/ktrzeciaknubisa/orgs","repos_url":"https://api.github.com/users/ktrzeciaknubisa/repos","events_url":"https://api.github.com/users/ktrzeciaknubisa/events{/privacy}","received_events_url":"https://api.github.com/users/ktrzeciaknubisa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jxcore/jxcore/labels/ready","name":"ready","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"obastemur","id":4390745,"avatar_url":"https://avatars.githubusercontent.com/u/4390745?v=3","gravatar_id":"","url":"https://api.github.com/users/obastemur","html_url":"https://github.com/obastemur","followers_url":"https://api.github.com/users/obastemur/followers","following_url":"https://api.github.com/users/obastemur/following{/other_user}","gists_url":"https://api.github.com/users/obastemur/gists{/gist_id}","starred_url":"https://api.github.com/users/obastemur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obastemur/subscriptions","organizations_url":"https://api.github.com/users/obastemur/orgs","repos_url":"https://api.github.com/users/obastemur/repos","events_url":"https://api.github.com/users/obastemur/events{/privacy}","received_events_url":"https://api.github.com/users/obastemur/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-03-17T17:05:26Z","updated_at":"2015-03-31T17:24:45Z","closed_at":"2015-03-31T17:24:45Z","body":"I've encountered this while testing `sendFile` of npm `express` module. It seems, that `express` before sending a file calls `fs.stat(path, function(err, stat) {})` and checks if `typeof stat` equals to \"object\". For SM this fails, since `typeof stat` is \"function\".\r\n\r\n```js\r\nvar fs = require('fs');\r\n\r\n// async method\r\nfs.stat(__filename, function (err, stat) {\r\n  console.log(\"ASYNC typeof stat:\", typeof stat);\r\n});\r\n\r\n// sync method\r\nvar stat = fs.statSync(__filename);\r\nconsole.log(\"SYNC typeof stat:\", typeof stat);\r\n```\r\n\r\nSM output:\r\n> SYNC typeof stat: **function**\r\nASYNC typeof stat: **function**\r\n\r\nV8 output:\r\n> SYNC typeof stat: **object**\r\nASYNC typeof stat: **object**\r\n\r\nHowever `stat instanceof fs.Stats` is still `true` and this have fooled our test cases. That's why the issue did not occur earlier."},"comment":{"url":"https://api.github.com/repos/jxcore/jxcore/issues/comments/88177953","html_url":"https://github.com/jxcore/jxcore/issues/242#issuecomment-88177953","issue_url":"https://api.github.com/repos/jxcore/jxcore/issues/242","id":88177953,"user":{"login":"obastemur","id":4390745,"avatar_url":"https://avatars.githubusercontent.com/u/4390745?v=3","gravatar_id":"","url":"https://api.github.com/users/obastemur","html_url":"https://github.com/obastemur","followers_url":"https://api.github.com/users/obastemur/followers","following_url":"https://api.github.com/users/obastemur/following{/other_user}","gists_url":"https://api.github.com/users/obastemur/gists{/gist_id}","starred_url":"https://api.github.com/users/obastemur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obastemur/subscriptions","organizations_url":"https://api.github.com/users/obastemur/orgs","repos_url":"https://api.github.com/users/obastemur/repos","events_url":"https://api.github.com/users/obastemur/events{/privacy}","received_events_url":"https://api.github.com/users/obastemur/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T17:24:45Z","updated_at":"2015-03-31T17:24:45Z","body":"Actually 'Stats' is a function not an Object. V8 shows 'object' for native function instances. Reported this on etag's repo: https://github.com/jshttp/etag/issues/10  "}}