* Check the CRC32 of an entry. * @param {ZipEntry} zipEntry the zip entry to check. * @return {Promise} the result.
(zipEntry)
| 1347 | * @return {Promise} the result. |
| 1348 | */ |
| 1349 | function checkEntryCRC32(zipEntry) { |
| 1350 | return new external.Promise(function (resolve, reject) { |
| 1351 | var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); |
| 1352 | worker.on("error", function (e) { |
| 1353 | reject(e); |
| 1354 | }) |
| 1355 | .on("end", function () { |
| 1356 | if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { |
| 1357 | reject(new Error("Corrupted zip : CRC32 mismatch")); |
| 1358 | } else { |
| 1359 | resolve(); |
| 1360 | } |
| 1361 | }) |
| 1362 | .resume(); |
| 1363 | }); |
| 1364 | } |
| 1365 | |
| 1366 | module.exports = function (data, options) { |
| 1367 | var zip = this; |
no test coverage detected