Compare commits

..

8 Commits

Author SHA1 Message Date
25e847a9ea 4.0.19 2023-11-14 13:17:06 +01:00
cc0ecb3f16 fix(core): update 2023-11-14 13:17:05 +01:00
2cd0846c74 4.0.18 2023-11-14 10:58:02 +01:00
49ab40af09 fix(core): update 2023-11-14 10:58:01 +01:00
5ff51ff88d 4.0.17 2023-11-14 10:55:20 +01:00
c578a3fdc1 fix(core): update 2023-11-14 10:55:19 +01:00
ad0352a712 4.0.16 2023-11-13 23:14:39 +01:00
f921338fd6 fix(core): update 2023-11-13 23:14:39 +01:00
6 changed files with 19 additions and 17 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartarchive",
"version": "4.0.15",
"version": "4.0.19",
"description": "work with archives",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -26,7 +26,7 @@
"@push.rocks/smartpromise": "^4.0.3",
"@push.rocks/smartrequest": "^2.0.21",
"@push.rocks/smartrx": "^3.0.7",
"@push.rocks/smartstream": "^3.0.27",
"@push.rocks/smartstream": "^3.0.30",
"@push.rocks/smartunique": "^3.0.6",
"@push.rocks/smarturl": "^3.0.7",
"@types/tar-stream": "^3.1.3",

10
pnpm-lock.yaml generated
View File

@ -21,8 +21,8 @@ dependencies:
specifier: ^3.0.7
version: 3.0.7
'@push.rocks/smartstream':
specifier: ^3.0.27
version: 3.0.27
specifier: ^3.0.30
version: 3.0.30
'@push.rocks/smartunique':
specifier: ^3.0.6
version: 3.0.6
@ -747,7 +747,7 @@ packages:
'@push.rocks/smartpath': 5.0.11
'@push.rocks/smartpromise': 4.0.3
'@push.rocks/smartrequest': 2.0.21
'@push.rocks/smartstream': 3.0.27
'@push.rocks/smartstream': 3.0.30
'@types/fs-extra': 11.0.3
'@types/glob': 8.1.0
'@types/js-yaml': 4.0.8
@ -964,8 +964,8 @@ packages:
through2: 4.0.2
dev: true
/@push.rocks/smartstream@3.0.27:
resolution: {integrity: sha512-ZIYYS/dVQab+BP2LIP4u4uUn1oqvRvb/vPUabirhyBJwF8VBYC3ssDp9P+oYcuZ3i+Od0G4g1GQuhtFWNv6hgw==}
/@push.rocks/smartstream@3.0.30:
resolution: {integrity: sha512-+izraXkILJJIy99PzP2LYahaW+g/35bTi/UxD7FeuOYbTaigode6Q3swvs0nrK6yu+A9x6RfoWV4JAJjd3Y87g==}
dependencies:
'@push.rocks/lik': 6.0.12
'@push.rocks/smartpromise': 4.0.3

View File

@ -47,4 +47,4 @@ tap.skip.test('should extract a b2zip', async () => {
);
})
tap.start();
await tap.start();

View File

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

View File

@ -54,12 +54,11 @@ export function unbzip2Stream() {
let counter = 0;
return new plugins.smartstream.SmartDuplex({
objectMode: true,
// writableObjectMode: true,
name: 'bzip2',
debug: true,
debug: false,
highWaterMark: 1,
writeFunction: async function (data, streamTools) {
console.log(`got chunk ${counter++}`)
// console.log(`got chunk ${counter++}`)
bufferQueue.push(data);
hasBytes += data.length;
if (bitReader === null) {
@ -81,6 +80,9 @@ export function unbzip2Stream() {
//console.error(x,'last compressing with', hasBytes, 'bytes in buffer');
while (!broken && bitReader && hasBytes > bitReader.bytesRead) {
const result = await decompressAndPush();
if (!result) {
continue;
}
await streamTools.push(result);
}
if (!broken) {

View File

@ -4,7 +4,7 @@ import * as plugins from './plugins.js';
export interface IAnalyzedResult {
fileType: plugins.fileType.FileTypeResult;
isArchive: boolean;
resultStream: plugins.smartstream.PassThrough;
resultStream: plugins.smartstream.SmartDuplex;
decompressionStream: plugins.stream.Transform | plugins.stream.Duplex | plugins.tarStream.Extract;
}
@ -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);