Fix shifting args in fs.readFile
This commit is contained in:
parent
4a485f9819
commit
4d01aa2772
1 changed files with 4 additions and 4 deletions
|
@ -135,16 +135,16 @@ fs.readFile = (p, options, callback) ->
|
||||||
[isAsar, asarPath, filePath] = splitPath p
|
[isAsar, asarPath, filePath] = splitPath p
|
||||||
return readFile.apply this, arguments unless isAsar
|
return readFile.apply this, arguments unless isAsar
|
||||||
|
|
||||||
|
if typeof options is 'function'
|
||||||
|
callback = options
|
||||||
|
options = undefined
|
||||||
|
|
||||||
archive = getOrCreateArchive asarPath
|
archive = getOrCreateArchive asarPath
|
||||||
return callback throw new Error("Invalid package #{asarPath}") unless archive
|
return callback throw new Error("Invalid package #{asarPath}") unless archive
|
||||||
|
|
||||||
info = archive.getFileInfo filePath
|
info = archive.getFileInfo filePath
|
||||||
return callback createNotFoundError(asarPath, filePath) unless info
|
return callback createNotFoundError(asarPath, filePath) unless info
|
||||||
|
|
||||||
if typeof options is 'function'
|
|
||||||
callback = options
|
|
||||||
options = undefined
|
|
||||||
|
|
||||||
if not options
|
if not options
|
||||||
options = encoding: null, flag: 'r'
|
options = encoding: null, flag: 'r'
|
||||||
else if util.isString options
|
else if util.isString options
|
||||||
|
|
Loading…
Reference in a new issue