From 2eccc86e835f1a04375b7668481e5f2d0a6d1f8d Mon Sep 17 00:00:00 2001 From: garronej Date: Sat, 18 Mar 2023 19:02:17 +0100 Subject: [PATCH] Remove eventEmitter warning --- src/bin/tools/downloadAndUnzip.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bin/tools/downloadAndUnzip.ts b/src/bin/tools/downloadAndUnzip.ts index 230e2575..916709ba 100644 --- a/src/bin/tools/downloadAndUnzip.ts +++ b/src/bin/tools/downloadAndUnzip.ts @@ -130,6 +130,7 @@ async function unzip(zipFile: string, dir: string, archiveDir?: string): Promise // Pull the file out of the archive, write it to the target directory const input = createRecordReadStream(); const output = createWriteStream(filePath); + output.setMaxListeners(Infinity); output.on("error", e => reject(Object.assign(e, { filePath }))); output.on("finish", () => resolve(filePath)); input.pipe(output); @@ -166,6 +167,7 @@ async function readFileChunk(file: string, start: number, end: number): Promise< const chunks: Buffer[] = []; return new Promise((resolve, reject) => { const stream = createReadStream(file, { start, end }); + stream.setMaxListeners(Infinity); stream.on("error", e => reject(e)); stream.on("end", () => resolve(Buffer.concat(chunks))); stream.on("data", chunk => chunks.push(chunk as Buffer));