fix(core): update

This commit is contained in:
2023-11-11 18:28:50 +01:00
parent 3e23534f9d
commit da22f375d2
11 changed files with 484 additions and 60 deletions

View File

@@ -30,14 +30,14 @@ export class ArchiveAnalyzer {
}
private getDecompressionStream(
private async getDecompressionStream(
mimeTypeArg: plugins.fileType.FileTypeResult['mime']
): plugins.stream.Transform | plugins.stream.Duplex | plugins.tarStream.Extract {
): Promise<plugins.stream.Transform | plugins.stream.Duplex | plugins.tarStream.Extract> {
switch (mimeTypeArg) {
case 'application/gzip':
return this.smartArchiveRef.gzipTools.getDecompressionStream();
case 'application/x-bzip2':
return this.smartArchiveRef.bzip2Tools.getDecompressionStream(); // replace with your own bzip2 decompression stream
return await this.smartArchiveRef.bzip2Tools.getDecompressionStream(); // replace with your own bzip2 decompression stream
case 'application/x-tar':
return this.smartArchiveRef.tarTools.getDecompressionStream(); // replace with your own tar decompression stream
default:
@@ -53,7 +53,7 @@ export class ArchiveAnalyzer {
readableObjectMode: true,
writeFunction: async (chunkArg: Buffer, streamtools) => {
const fileType = await plugins.fileType.fileTypeFromBuffer(chunkArg);
const decompressionStream = this.getDecompressionStream(fileType?.mime as any);
const decompressionStream = await this.getDecompressionStream(fileType?.mime as any);
resultStream.push(chunkArg);
if (firstRun) {
firstRun = false;