fix(core): update

This commit is contained in:
2023-11-14 10:55:19 +01:00
parent ad0352a712
commit c578a3fdc1
6 changed files with 14 additions and 14 deletions

View File

@@ -52,11 +52,10 @@ export class ArchiveAnalyzer {
const analyzerstream = new plugins.smartstream.SmartDuplex<Buffer, IAnalyzedResult>({
readableObjectMode: true,
writeFunction: async (chunkArg: Buffer, streamtools) => {
const fileType = await plugins.fileType.fileTypeFromBuffer(chunkArg);
const decompressionStream = await this.getDecompressionStream(fileType?.mime as any);
resultStream.push(chunkArg);
if (firstRun) {
firstRun = false;
const fileType = await plugins.fileType.fileTypeFromBuffer(chunkArg);
const decompressionStream = await this.getDecompressionStream(fileType?.mime as any);
const result: IAnalyzedResult = {
fileType,
isArchive: await this.mimeTypeIsArchive(fileType?.mime),
@@ -64,8 +63,9 @@ export class ArchiveAnalyzer {
decompressionStream,
};
await streamtools.push(result);
return null;
}
await resultStream.backpressuredPush(chunkArg);
return null;
},
finalFunction: async (tools) => {
resultStream.push(null);