fix:修复modrinth json读取失败
This commit is contained in:
@@ -8,14 +8,16 @@ import { MultiBar } from "cli-progress";
|
||||
import {URL, fileURLToPath } from "node:url";
|
||||
import { LOGGER } from "./logger.js";
|
||||
|
||||
export async function readzipentry(zipfile: yauzl.ZipFile, entry: yauzl.Entry):Promise<string|Buffer> {
|
||||
export async function readzipentry(zipfile: yauzl.ZipFile, entry: yauzl.Entry):Promise<string> {
|
||||
const data: Buffer<ArrayBufferLike>[] = [];
|
||||
return await new Promise((reslove, reject) => {
|
||||
zipfile.openReadStream(entry, (err, e) => {
|
||||
e.on("data", (chunk: Buffer) => {
|
||||
data.push(chunk);
|
||||
}).on("end", () => {
|
||||
reslove(data.toString());
|
||||
if (data.length !== 0&&typeof data !== "string"){
|
||||
reslove(Buffer.concat(data).toString());
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user