r2-shared-js
Version:
Readium 2 'shared' for NodeJS (TypeScript)
30 lines • 901 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.zipHasEntry = zipHasEntry;
const debug_ = require("debug");
const debug = debug_("r2:shared#utils/zipHasEntry");
async function zipHasEntry(zip, zipPath, zipPathOther) {
let has = zip.hasEntry(zipPath);
if (zip.hasEntryAsync) {
try {
has = await zip.hasEntryAsync(zipPath);
}
catch (err) {
console.log(err);
}
}
if (!has && zipPathOther && zipPathOther !== zipPath) {
debug(`zipHasEntry: ${zipPath} => ${zipPathOther}`);
has = zip.hasEntry(zipPathOther);
if (zip.hasEntryAsync) {
try {
has = await zip.hasEntryAsync(zipPathOther);
}
catch (err) {
console.log(err);
}
}
}
return has;
}
//# sourceMappingURL=zipHasEntry.js.map