( archivePath, destPath, expectedNames, targetName, runFile = execFileSync, )
| 91 | } |
| 92 | |
| 93 | function extractExactTarArchive( |
| 94 | archivePath, destPath, expectedNames, targetName, runFile = execFileSync, |
| 95 | ) { |
| 96 | const listing = runFile('tar', ['-tzf', archivePath], { |
| 97 | encoding: 'utf8', |
| 98 | maxBuffer: MAX_CHECKSUM_MANIFEST_BYTES, |
| 99 | windowsHide: true, |
| 100 | }); |
| 101 | validateExactTarMemberListing(listing, expectedNames); |
| 102 | // Extract only the fixed root executable. Even a malformed tar implementation |
| 103 | // cannot write an unvalidated companion member outside the private temp tree. |
| 104 | runFile('tar', ['-xzf', archivePath, '-C', destPath, targetName], { |
| 105 | stdio: 'inherit', |
| 106 | windowsHide: true, |
| 107 | }); |
| 108 | } |
| 109 | |
| 110 | function downloadHop(url, dest, maxBytes) { |
| 111 | return new Promise((resolve, reject) => { |
no test coverage detected