Update internalModuleReadFile to support unpacked asar files

Add tests for reading unpacked files using both fs.readFileSync and
internalModuleReadFile
This commit is contained in:
Rich Hong 2015-06-22 19:38:47 -04:00
parent 339496a361
commit f51103f44a
2 changed files with 23 additions and 0 deletions

View file

@ -323,6 +323,10 @@ exports.wrapFsWithAsar = (fs) ->
return undefined unless info
return '' if info.size is 0
if info.unpacked
realPath = archive.copyFileOut filePath
return fs.readFileSync realPath, encoding: 'utf8'
buffer = new Buffer(info.size)
fd = archive.getFd()
retrun undefined unless fd >= 0