Fix shifting args in fs.readFile

This commit is contained in:
Cheng Zhao 2014-09-28 23:36:12 +08:00
parent 4a485f9819
commit 4d01aa2772

View file

@ -135,16 +135,16 @@ fs.readFile = (p, options, callback) ->
[isAsar, asarPath, filePath] = splitPath p
return readFile.apply this, arguments unless isAsar
if typeof options is 'function'
callback = options
options = undefined
archive = getOrCreateArchive asarPath
return callback throw new Error("Invalid package #{asarPath}") unless archive
info = archive.getFileInfo filePath
return callback createNotFoundError(asarPath, filePath) unless info
if typeof options is 'function'
callback = options
options = undefined
if not options
options = encoding: null, flag: 'r'
else if util.isString options