Leone25 / hub-young-downloader

A tool that allows you to create an ofline backup of your books on HUB Young and HUB Kids
MIT License
18 stars 2 forks source link

Invalid or unsupported zip format. No END header found #17

Open dlade96 opened 2 months ago

dlade96 commented 2 months ago

at readMainHeader (F:\Download\hub-young-downloader-main\hub-young-downloader-main\node_modules\adm-zip\zipFile.js:102:32) at new module.exports (F:\Download\hub-young-downloader-main\hub-young-downloader-main\node_modules\adm-zip\zipFile.js:20:9) at new module.exports (F:\Download\hub-young-downloader-main\hub-young-downloader-main\node_modules\adm-zip\adm-zip.js:62:18) at file:///F:/Download/hub-young-downloader-main/hub-young-downloader-main/index.js:134:21 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

rotragit commented 1 month ago

add try/catch blocks:

 try {
                const zip = new AdmZip(Buffer.from(res));
                await zip.extractAllTo(`temp/build`);
        }
        catch (error) {
                console.error(error);
        }

and

try {
        const files = fsExtra.readdirSync(base);
        for (const file of files) {
            if (file.includes(".pdf")) {
                await merger.add(`${base}/${file}`);
            }
        }
        } catch (error) { console.error(error); }
luigiguarnieri commented 1 month ago

Downloading pages... /Volumes/WD_Black/luigiguarnieri/hub_young/node_modules/adm-zip/zipFile.js:102 if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT); ^

Error: Invalid or unsupported zip format. No END header found at readMainHeader (/Volumes/WD_Black/luigiguarnieri/hub_young/node_modules/adm-zip/zipFile.js:102:32) at new module.exports (/Volumes/WD_Black/luigiguarnieri/hub_young/node_modules/adm-zip/zipFile.js:20:9) at new module.exports (/Volumes/WD_Black/luigiguarnieri/hub_young/node_modules/adm-zip/adm-zip.js:62:18) at file:///Volumes/WD_Black/luigiguarnieri/hub_young/index.js:134:21 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.18.0