@push.rocks/smartarchive 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist_ts/00_commitinfo_data.js +2 -2
  2. package/dist_ts/classes.archiveanalyzer.d.ts +1 -1
  3. package/dist_ts/classes.archiveanalyzer.js +34 -4
  4. package/dist_ts/classes.smartarchive.d.ts +151 -54
  5. package/dist_ts/classes.smartarchive.js +484 -234
  6. package/dist_ts/classes.tartools.d.ts +9 -33
  7. package/dist_ts/classes.tartools.js +18 -153
  8. package/dist_ts/index.d.ts +2 -6
  9. package/dist_ts/index.js +7 -11
  10. package/dist_ts/paths.js +1 -1
  11. package/dist_ts/plugins.d.ts +2 -9
  12. package/dist_ts/plugins.js +6 -13
  13. package/npmextra.json +13 -7
  14. package/package.json +23 -14
  15. package/readme.hints.md +69 -23
  16. package/readme.md +360 -274
  17. package/ts/00_commitinfo_data.ts +1 -1
  18. package/ts/classes.archiveanalyzer.ts +33 -5
  19. package/ts/classes.smartarchive.ts +546 -256
  20. package/ts/classes.tartools.ts +20 -177
  21. package/ts/index.ts +7 -11
  22. package/ts/plugins.ts +5 -17
  23. package/{ts → ts_shared}/bzip2/bititerator.ts +1 -1
  24. package/{ts → ts_shared}/bzip2/bzip2.ts +2 -2
  25. package/{ts → ts_shared}/bzip2/index.ts +6 -6
  26. package/ts_shared/classes.bzip2tools.ts +14 -0
  27. package/ts_shared/classes.gziptools.ts +42 -0
  28. package/ts_shared/classes.tartools.ts +89 -0
  29. package/ts_shared/classes.ziptools.ts +107 -0
  30. package/ts_shared/index.ts +17 -0
  31. package/{ts → ts_shared}/interfaces.ts +23 -7
  32. package/ts_shared/plugins.ts +22 -0
  33. package/ts_web/00_commitinfo_data.ts +8 -0
  34. package/ts_web/index.ts +4 -0
  35. package/ts_web/plugins.ts +3 -0
  36. package/dist_ts/bzip2/bititerator.d.ts +0 -6
  37. package/dist_ts/bzip2/bititerator.js +0 -50
  38. package/dist_ts/bzip2/bzip2.d.ts +0 -29
  39. package/dist_ts/bzip2/bzip2.js +0 -398
  40. package/dist_ts/bzip2/index.d.ts +0 -5
  41. package/dist_ts/bzip2/index.js +0 -92
  42. package/dist_ts/classes.bzip2tools.d.ts +0 -7
  43. package/dist_ts/classes.bzip2tools.js +0 -11
  44. package/dist_ts/classes.gziptools.d.ts +0 -49
  45. package/dist_ts/classes.gziptools.js +0 -125
  46. package/dist_ts/classes.ziptools.d.ts +0 -56
  47. package/dist_ts/classes.ziptools.js +0 -185
  48. package/dist_ts/errors.d.ts +0 -44
  49. package/dist_ts/errors.js +0 -62
  50. package/dist_ts/interfaces.d.ts +0 -115
  51. package/dist_ts/interfaces.js +0 -2
  52. package/dist_ts/smartarchive.classes.smartarchive.d.ts +0 -34
  53. package/dist_ts/smartarchive.classes.smartarchive.js +0 -116
  54. package/dist_ts/smartarchive.paths.d.ts +0 -2
  55. package/dist_ts/smartarchive.paths.js +0 -4
  56. package/dist_ts/smartarchive.plugins.d.ts +0 -14
  57. package/dist_ts/smartarchive.plugins.js +0 -19
  58. package/ts/classes.bzip2tools.ts +0 -16
  59. package/ts/classes.gziptools.ts +0 -143
  60. package/ts/classes.ziptools.ts +0 -209
  61. /package/{ts → ts_shared}/errors.ts +0 -0
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartarchive',
6
- version: '5.0.0',
6
+ version: '5.1.0',
7
7
  description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import type { SmartArchive } from './classes.smartarchive.js';
2
- import type { TSupportedMime } from './interfaces.js';
2
+ import type { TSupportedMime } from '../ts_shared/interfaces.js';
3
3
  import * as plugins from './plugins.js';
4
4
 
5
5
  /**
@@ -8,7 +8,7 @@ import * as plugins from './plugins.js';
8
8
  export type TDecompressionStream =
9
9
  | plugins.stream.Transform
10
10
  | plugins.stream.Duplex
11
- | plugins.tarStream.Extract;
11
+ | plugins.smartstream.SmartDuplex<any, any>;
12
12
 
13
13
  /**
14
14
  * Result of archive analysis
@@ -53,14 +53,42 @@ export class ArchiveAnalyzer {
53
53
  */
54
54
  private async getDecompressionStream(mimeTypeArg: TSupportedMime): Promise<TDecompressionStream> {
55
55
  switch (mimeTypeArg) {
56
- case 'application/gzip':
57
- return this.smartArchiveRef.gzipTools.getDecompressionStream();
56
+ case 'application/gzip': {
57
+ // Use fflate streaming Gunzip - instance must be created once and reused
58
+ let gunzip: plugins.fflate.Gunzip;
59
+ return new plugins.stream.Transform({
60
+ construct(callback) {
61
+ gunzip = new plugins.fflate.Gunzip((data, final) => {
62
+ this.push(Buffer.from(data));
63
+ });
64
+ callback();
65
+ },
66
+ transform(chunk, encoding, callback) {
67
+ try {
68
+ gunzip.push(chunk, false);
69
+ callback();
70
+ } catch (err) {
71
+ callback(err as Error);
72
+ }
73
+ },
74
+ flush(callback) {
75
+ try {
76
+ // Signal end of stream with empty final chunk
77
+ gunzip.push(new Uint8Array(0), true);
78
+ callback();
79
+ } catch (err) {
80
+ callback(err as Error);
81
+ }
82
+ }
83
+ });
84
+ }
58
85
  case 'application/zip':
59
86
  return this.smartArchiveRef.zipTools.getDecompressionStream();
60
87
  case 'application/x-bzip2':
61
88
  return this.smartArchiveRef.bzip2Tools.getDecompressionStream();
62
89
  case 'application/x-tar':
63
- return this.smartArchiveRef.tarTools.getDecompressionStream();
90
+ // TAR doesn't need decompression, just pass through
91
+ return plugins.smartstream.createPassThrough();
64
92
  default:
65
93
  // Handle unsupported formats or no decompression needed
66
94
  return plugins.smartstream.createPassThrough();