Skip to content

Commit

Permalink
Removed check for invalid archive on download
Browse files Browse the repository at this point in the history
  • Loading branch information
piranna committed May 14, 2016
1 parent d112f75 commit 7e8ad6c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions download.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,26 @@ function downloadPrebuild (opts, cb) {
log.info('unpacking @', cachedPrebuild)
pump(fs.createReadStream(cachedPrebuild), zlib.createGunzip(), tfs.extract(opts.path, {readable: true, writable: true}).on('entry', updateName), function (err) {
if (err) return cb(err)
if (!binaryName) return cb(error.invalidArchive())

var resolved
try {
resolved = path.resolve(opts.path || '.', binaryName)
} catch (err) {
return cb(err)
}
log.info('unpack', 'resolved to ' + resolved)

if (opts.abi === process.versions.modules) {
if (binaryName) {
try {
require(resolved)
resolved = path.resolve(opts.path || '.', binaryName)
} catch (err) {
return cb(err)
}
log.info('unpack', 'required ' + resolved + ' successfully')
log.info('unpack', 'resolved to ' + resolved)

if (opts.abi === process.versions.modules) {
try {
require(resolved)
} catch (err) {
return cb(err)
}
log.info('unpack', 'required ' + resolved + ' successfully')
}
}

cb(null, resolved)
})
}
Expand Down

0 comments on commit 7e8ad6c

Please sign in to comment.