Merge pull request #3275 from atom/as-optimize-fs-read-file-sync

Allow v8 to optimize fs.readFileSync
This commit is contained in:
Cheng Zhao 2015-10-30 20:02:34 +08:00
commit d223faa9f4

View file

@ -254,7 +254,8 @@ exports.wrapFsWithAsar = (fs) ->
openSync = fs.openSync
readFileSync = fs.readFileSync
fs.readFileSync = (p, options) ->
fs.readFileSync = (p, opts) ->
options = opts # this allows v8 to optimize this function
[isAsar, asarPath, filePath] = splitPath p
return readFileSync.apply this, arguments unless isAsar