diff --git a/src/main/models/yauzl-zip.class.ts b/src/main/models/yauzl-zip.class.ts index 41b70ec5..83774e10 100644 --- a/src/main/models/yauzl-zip.class.ts +++ b/src/main/models/yauzl-zip.class.ts @@ -1,5 +1,6 @@ import { createWriteStream, ensureDir } from "fs-extra"; import path from "path"; +import { Readable } from "stream"; import yauzl, { ZipFile, Options, Entry } from "yauzl" export class YauzlZip { @@ -12,7 +13,7 @@ export class YauzlZip { public static fromPath(path: string): Promise { return new Promise((resolve, reject) => { - yauzl.open(path, YauzlZip.YAUZL_OPEN_OPTIONS, (error, zip) => { + yauzl.open(path, YauzlZip.YAUZL_OPEN_OPTIONS, (error: Error, zip: yauzl.ZipFile) => { if (error) return reject(error); resolve(new YauzlZip(zip)); }); @@ -21,7 +22,7 @@ export class YauzlZip { public static fromBuffer(buffer: Buffer): Promise { return new Promise((resolve, reject) => { - yauzl.fromBuffer(buffer, YauzlZip.YAUZL_OPEN_OPTIONS, (error, zip) => { + yauzl.fromBuffer(buffer, YauzlZip.YAUZL_OPEN_OPTIONS, (error: Error, zip: yauzl.ZipFile) => { if (error) return reject(error); resolve(new YauzlZip(zip)); }); @@ -31,7 +32,7 @@ export class YauzlZip { private readonly zip: ZipFile; private readonly entriesMap = new Map(); - constructor(zip: ZipFile){ + private constructor(zip: ZipFile) { this.zip = zip; } @@ -160,7 +161,7 @@ class YauzlZipEntry { public async read(): Promise { return new Promise((resolve, reject) => { - this.zip.openReadStream(this.entry, (error, stream) => { + this.zip.openReadStream(this.entry, (error: Error, stream: Readable) => { if (error) return reject(error); const buffers: Buffer[] = []; stream.on("data", (data) => buffers.push(data as Buffer)); @@ -179,7 +180,7 @@ class YauzlZipEntry { } return new Promise((resolve, reject) => { - this.zip.openReadStream(this.entry, async (error, stream) => { + this.zip.openReadStream(this.entry, async (error: Error, stream: Readable) => { if (error) return reject(error); await ensureDir(path.dirname(destPath)); diff --git a/src/main/services/additional-content/maps/local-maps-manager.service.ts b/src/main/services/additional-content/maps/local-maps-manager.service.ts index a353c114..ced486b7 100644 --- a/src/main/services/additional-content/maps/local-maps-manager.service.ts +++ b/src/main/services/additional-content/maps/local-maps-manager.service.ts @@ -369,7 +369,7 @@ export class LocalMapsManagerService { log.info("Extracting", `"${zipPath}"`, "into", `"${mapsPath}"`); for (const folder of mapsFolders) { - log.info("*", folder); + log.info(">", folder); const regex = new RegExp(`^${folder .replaceAll(".", "\\.") .replaceAll("+", "\\+") @@ -377,7 +377,7 @@ export class LocalMapsManagerService { .replaceAll(")", "\\)") .replaceAll("[", "\\[") .replaceAll("]", "\\]") - }\/`); + }\\/`); await zip.extract(destination, { entriesNames: [regex],