(filename)
| 42 | |
| 43 | // Downloads a test file only once and returns the buffer for the file. |
| 44 | async function fetchOnceAndSaveToDiskWithBuffer(filename) { |
| 45 | return new Promise(resolve => { |
| 46 | const url = `${BASE_URL}${filename}.gz`; |
| 47 | if (fs.existsSync(filename)) { |
| 48 | resolve(readFile(filename)); |
| 49 | return; |
| 50 | } |
| 51 | const file = fs.createWriteStream(filename); |
| 52 | console.log(` * Downloading from: ${url}`); |
| 53 | https.get(url, (response) => { |
| 54 | const unzip = zlib.createGunzip(); |
| 55 | response.pipe(unzip).pipe(file); |
| 56 | unzip.on('end', () => { |
| 57 | resolve(readFile(filename)); |
| 58 | }); |
| 59 | }); |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | function loadHeaderValues(buffer, headerLength) { |
| 64 | const headerValues = []; |
no outgoing calls
no test coverage detected