jspm / npm

NPM Location Service
19 stars 31 forks source link

Only unzip if the npm package is gzipped #148

Closed MortenHoustonLudvigsen closed 8 years ago

MortenHoustonLudvigsen commented 8 years ago

It turns out that not all packages downloaded from npm are actually gzipped (even though they are named *.tgz). Specifically, I have seen this with the @types scope introduced recently for use with typescript. In theses cases jspm install fails when trying to unzip:

jspm install npm:@types/jquery
     Updating registry cache...
     Downloading npm:@types/jquery@1.10.28

err  Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:370:17)

This pull request resolves this by checking whether the downloaded package is actually gzipped, and only extracts the tar contents if not.

This is basically the same PR as #147 but tweaked to work with 0.17

guybedford commented 8 years ago

👍