Consolidate gunzip logic

This commit is contained in:
Michael Jackson
2019-08-02 16:06:13 -07:00
parent 746a6fddf5
commit be843179d4
7 changed files with 6 additions and 12 deletions

View File

@ -1,5 +1,6 @@
import url from 'url';
import https from 'https';
import gunzip from 'gunzip-maybe';
import LRUCache from 'lru-cache';
import debug from './debug.js';
@ -179,7 +180,9 @@ export async function getPackage(packageName, version) {
const res = await get(options);
if (res.statusCode === 200) {
return res;
const stream = res.pipe(gunzip());
// stream.pause();
return stream;
}
const data = await bufferStream(res);