fix(core): update
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartarchive',
|
||||
version: '4.0.16',
|
||||
version: '4.0.17',
|
||||
description: 'work with archives'
|
||||
}
|
||||
|
@ -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++}`)
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user