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

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartarchive',
version: '4.0.16',
version: '4.0.17',
description: 'work with archives'
}

View File

@ -55,7 +55,7 @@ export function unbzip2Stream() {
return new plugins.smartstream.SmartDuplex({
objectMode: true,
name: 'bzip2',
// debug: true,
debug: true,
highWaterMark: 1,
writeFunction: async function (data, streamTools) {
// console.log(`got chunk ${counter++}`)

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);