node-liblzma 2.0.3 → 2.2.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.
- package/README.md +263 -67
- package/index.d.ts +60 -3
- package/lib/cli/nxz.d.ts +7 -0
- package/lib/cli/nxz.d.ts.map +1 -0
- package/lib/cli/nxz.js +486 -0
- package/lib/cli/nxz.js.map +1 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +26 -15
- package/lib/errors.js.map +1 -1
- package/lib/lzma.d.ts +319 -2
- package/lib/lzma.d.ts.map +1 -1
- package/lib/lzma.js +303 -39
- package/lib/lzma.js.map +1 -1
- package/lib/pool.d.ts.map +1 -1
- package/lib/pool.js +9 -3
- package/lib/pool.js.map +1 -1
- package/lib/types.d.ts +68 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +32 -12
- package/scripts/build_xz_with_cmake.py +23 -26
- package/src/bindings/module.cpp +196 -0
- package/src/bindings/node-liblzma.cpp +40 -4
- package/src/bindings/node-liblzma.hpp +2 -1
- package/xz-version.json +3 -3
- package/.gitattributes +0 -3
- package/.release-it.json +0 -7
- package/.release-it.manual.json +0 -7
- package/.release-it.retry.json +0 -3
- package/CHANGELOG.md +0 -271
- package/History.md +0 -79
- package/RELEASING.md +0 -131
- package/biome.json +0 -81
- package/pnpm-workspace.yaml +0 -3
- package/prebuilds/darwin-x64/node-liblzma.node +0 -0
- package/prebuilds/linux-x64/node-liblzma.node +0 -0
- package/prebuilds/win32-x64/node-liblzma.node +0 -0
- package/scripts/analyze-coverage.js +0 -132
- package/scripts/compare-coverage-tools.js +0 -93
- package/src/errors.ts +0 -167
- package/src/lzma.ts +0 -839
- package/src/pool.ts +0 -228
- package/src/types.ts +0 -30
- package/tsconfig.json +0 -50
- package/vitest.config.istanbul.ts +0 -29
- package/vitest.config.monocart.ts +0 -44
- package/vitest.config.ts +0 -52
package/lib/lzma.d.ts
CHANGED
|
@@ -18,44 +18,107 @@
|
|
|
18
18
|
import { Transform, type TransformCallback, type TransformOptions } from 'node:stream';
|
|
19
19
|
import type { NativeLZMA } from '../index.js';
|
|
20
20
|
import { LZMABufferError, LZMADataError, LZMAError, LZMAFormatError, LZMAMemoryError, LZMAMemoryLimitError, LZMAOptionsError, LZMAProgrammingError } from './errors.js';
|
|
21
|
-
import type { CheckType, CompressionCallback, FilterType, LZMAActionType, LZMAOptions, LZMAStatusType, ModeType, PresetType } from './types.js';
|
|
21
|
+
import type { CheckType, CompressionCallback, FilterType, LZMAActionType, LZMAOptions, LZMAStatusType, ModeType, PresetType, ProgressInfo } from './types.js';
|
|
22
22
|
export { LZMAError, LZMAMemoryError, LZMAMemoryLimitError, LZMAFormatError, LZMAOptionsError, LZMADataError, LZMABufferError, LZMAProgrammingError, };
|
|
23
23
|
export { LZMAPool, type PoolMetrics } from './pool.js';
|
|
24
|
+
/**
|
|
25
|
+
* Integrity check types for XZ streams.
|
|
26
|
+
* Use CRC64 for best balance of speed and error detection.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const compressor = createXz({ check: check.CRC64 });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
24
32
|
export declare const check: {
|
|
25
33
|
readonly NONE: any;
|
|
26
34
|
readonly CRC32: any;
|
|
27
35
|
readonly CRC64: any;
|
|
28
36
|
readonly SHA256: any;
|
|
29
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Compression preset flags.
|
|
40
|
+
* Can be combined with preset level using bitwise OR.
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const compressor = createXz({ preset: 6 | preset.EXTREME });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
30
46
|
export declare const preset: {
|
|
47
|
+
/** Default compression level (6) */
|
|
31
48
|
readonly DEFAULT: any;
|
|
49
|
+
/** Extreme mode flag - slower but better compression */
|
|
32
50
|
readonly EXTREME: any;
|
|
33
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Decoder flags for controlling decompression behavior.
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const decompressor = createUnxz({ flushFlag: flag.CONCATENATED });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
34
59
|
export declare const flag: {
|
|
60
|
+
/** Tell decoder if input has no integrity check */
|
|
35
61
|
readonly TELL_NO_CHECK: any;
|
|
62
|
+
/** Tell decoder if integrity check is unsupported */
|
|
36
63
|
readonly TELL_UNSUPPORTED_CHECK: any;
|
|
64
|
+
/** Tell decoder about any integrity check type */
|
|
37
65
|
readonly TELL_ANY_CHECK: any;
|
|
66
|
+
/** Allow concatenated XZ streams */
|
|
38
67
|
readonly CONCATENATED: any;
|
|
39
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Compression filters for preprocessing data before LZMA2.
|
|
71
|
+
* BCJ filters improve compression for executable code.
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // Compress x86 executable with BCJ filter
|
|
75
|
+
* const compressor = createXz({ filters: [filter.X86, filter.LZMA2] });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
40
78
|
export declare const filter: {
|
|
79
|
+
/** LZMA2 compression filter (required, must be last) */
|
|
41
80
|
readonly LZMA2: any;
|
|
81
|
+
/** BCJ filter for x86 executables */
|
|
42
82
|
readonly X86: any;
|
|
83
|
+
/** BCJ filter for PowerPC executables */
|
|
43
84
|
readonly POWERPC: any;
|
|
85
|
+
/** BCJ filter for IA-64 executables */
|
|
44
86
|
readonly IA64: any;
|
|
87
|
+
/** BCJ filter for ARM executables */
|
|
45
88
|
readonly ARM: any;
|
|
89
|
+
/** BCJ filter for ARM-Thumb executables */
|
|
46
90
|
readonly ARMTHUMB: any;
|
|
91
|
+
/** BCJ filter for SPARC executables */
|
|
47
92
|
readonly SPARC: any;
|
|
48
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Compression mode selection.
|
|
96
|
+
* FAST uses less memory, NORMAL provides better compression.
|
|
97
|
+
*/
|
|
49
98
|
export declare const mode: {
|
|
99
|
+
/** Fast compression mode - less memory, faster */
|
|
50
100
|
readonly FAST: any;
|
|
101
|
+
/** Normal compression mode - better ratio */
|
|
51
102
|
readonly NORMAL: any;
|
|
52
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* LZMA stream action constants.
|
|
106
|
+
* Control how the encoder/decoder processes input.
|
|
107
|
+
*/
|
|
53
108
|
export declare const LZMAAction: {
|
|
109
|
+
/** Normal processing - continue encoding/decoding */
|
|
54
110
|
readonly RUN: any;
|
|
111
|
+
/** Flush pending output synchronously */
|
|
55
112
|
readonly SYNC_FLUSH: any;
|
|
113
|
+
/** Flush and reset encoder state */
|
|
56
114
|
readonly FULL_FLUSH: any;
|
|
115
|
+
/** Finish the stream - no more input */
|
|
57
116
|
readonly FINISH: any;
|
|
58
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* LZMA operation status/return codes.
|
|
120
|
+
* Used to indicate the result of encoding/decoding operations.
|
|
121
|
+
*/
|
|
59
122
|
export declare const LZMAStatus: {
|
|
60
123
|
readonly OK: any;
|
|
61
124
|
readonly STREAM_END: any;
|
|
@@ -77,12 +140,19 @@ export declare const LZMAFilter: {
|
|
|
77
140
|
readonly ARM_ALT: any;
|
|
78
141
|
readonly ARMTHUMB_ALT: any;
|
|
79
142
|
readonly FILTERS_MAX: any;
|
|
143
|
+
/** LZMA2 compression filter (required, must be last) */
|
|
80
144
|
readonly LZMA2: any;
|
|
145
|
+
/** BCJ filter for x86 executables */
|
|
81
146
|
readonly X86: any;
|
|
147
|
+
/** BCJ filter for PowerPC executables */
|
|
82
148
|
readonly POWERPC: any;
|
|
149
|
+
/** BCJ filter for IA-64 executables */
|
|
83
150
|
readonly IA64: any;
|
|
151
|
+
/** BCJ filter for ARM executables */
|
|
84
152
|
readonly ARM: any;
|
|
153
|
+
/** BCJ filter for ARM-Thumb executables */
|
|
85
154
|
readonly ARMTHUMB: any;
|
|
155
|
+
/** BCJ filter for SPARC executables */
|
|
86
156
|
readonly SPARC: any;
|
|
87
157
|
};
|
|
88
158
|
export declare const LZMA_RUN: any;
|
|
@@ -107,7 +177,20 @@ export declare const LZMA_FILTER_IA64: any;
|
|
|
107
177
|
export declare const LZMA_FILTER_ARM: any;
|
|
108
178
|
export declare const LZMA_FILTER_ARMTHUMB: any;
|
|
109
179
|
export declare const LZMA_FILTERS_MAX: any;
|
|
110
|
-
export type { LZMAOptions, CompressionCallback, LZMAActionType, LZMAStatusType, CheckType, PresetType, FilterType, ModeType, };
|
|
180
|
+
export type { LZMAOptions, CompressionCallback, LZMAActionType, LZMAStatusType, CheckType, PresetType, FilterType, ModeType, ProgressInfo, };
|
|
181
|
+
/**
|
|
182
|
+
* Abstract base class for XZ compression/decompression streams.
|
|
183
|
+
* Extends Node.js Transform stream with LZMA2 encoding/decoding.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* // Use Xz or Unxz classes instead of XzStream directly
|
|
188
|
+
* const compressor = new Xz({ preset: 6 });
|
|
189
|
+
* readStream.pipe(compressor).pipe(writeStream);
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* Emits `progress` event after each chunk with `{bytesRead, bytesWritten}` info.
|
|
193
|
+
*/
|
|
111
194
|
export declare abstract class XzStream extends Transform {
|
|
112
195
|
protected _opts: Required<LZMAOptions>;
|
|
113
196
|
protected _chunkSize: number;
|
|
@@ -117,8 +200,20 @@ export declare abstract class XzStream extends Transform {
|
|
|
117
200
|
protected _hadError: boolean;
|
|
118
201
|
protected _offset: number;
|
|
119
202
|
protected _buffer: Buffer;
|
|
203
|
+
/** Total bytes read from input */
|
|
204
|
+
protected _bytesRead: number;
|
|
205
|
+
/** Total bytes written to output */
|
|
206
|
+
protected _bytesWritten: number;
|
|
120
207
|
constructor(streamMode: number, opts?: LZMAOptions, options?: TransformOptions);
|
|
121
208
|
private _createLZMAError;
|
|
209
|
+
/** Get total bytes read from input so far */
|
|
210
|
+
get bytesRead(): number;
|
|
211
|
+
/** Get total bytes written to output so far */
|
|
212
|
+
get bytesWritten(): number;
|
|
213
|
+
/**
|
|
214
|
+
* Emit a progress event with current bytesRead and bytesWritten
|
|
215
|
+
*/
|
|
216
|
+
protected _emitProgress(): void;
|
|
122
217
|
private _reallocateBuffer;
|
|
123
218
|
flush(callback?: () => void): void;
|
|
124
219
|
flush(kind: number, callback?: () => void): void;
|
|
@@ -127,15 +222,147 @@ export declare abstract class XzStream extends Transform {
|
|
|
127
222
|
_flush(callback: TransformCallback): void;
|
|
128
223
|
_processChunk(chunk: Buffer | null, flushFlag: number, cb?: TransformCallback): Buffer | undefined;
|
|
129
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* XZ compression stream.
|
|
227
|
+
* Compresses data using LZMA2 algorithm.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* const compressor = new Xz({ preset: 6 });
|
|
232
|
+
* input.pipe(compressor).pipe(output);
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
130
235
|
export declare class Xz extends XzStream {
|
|
131
236
|
constructor(lzmaOptions?: LZMAOptions, options?: TransformOptions);
|
|
132
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* XZ decompression stream.
|
|
240
|
+
* Decompresses data compressed with XZ/LZMA2.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* const decompressor = new Unxz();
|
|
245
|
+
* compressedInput.pipe(decompressor).pipe(output);
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
133
248
|
export declare class Unxz extends XzStream {
|
|
134
249
|
constructor(lzmaOptions?: LZMAOptions, options?: TransformOptions);
|
|
135
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Create a new XZ compression stream.
|
|
253
|
+
* @param lzmaOptions - LZMA compression options
|
|
254
|
+
* @param options - Node.js Transform stream options
|
|
255
|
+
* @returns New Xz compression stream
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* const compressor = createXz({ preset: 9 });
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
136
262
|
export declare function createXz(lzmaOptions?: LZMAOptions, options?: TransformOptions): Xz;
|
|
263
|
+
/**
|
|
264
|
+
* Create a new XZ decompression stream.
|
|
265
|
+
* @param lzmaOptions - LZMA decompression options
|
|
266
|
+
* @param options - Node.js Transform stream options
|
|
267
|
+
* @returns New Unxz decompression stream
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```ts
|
|
271
|
+
* const decompressor = createUnxz();
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
137
274
|
export declare function createUnxz(lzmaOptions?: LZMAOptions, options?: TransformOptions): Unxz;
|
|
275
|
+
/**
|
|
276
|
+
* Check if liblzma was built with threading support.
|
|
277
|
+
* @returns true if multi-threaded compression is available
|
|
278
|
+
*/
|
|
138
279
|
export declare function hasThreads(): boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Check if a buffer contains XZ compressed data by examining magic bytes.
|
|
282
|
+
* @param buffer - Buffer to check (needs at least 6 bytes)
|
|
283
|
+
* @returns true if the buffer starts with XZ magic bytes
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* const compressed = await xzAsync(Buffer.from('Hello'));
|
|
287
|
+
* console.log(isXZ(compressed)); // true
|
|
288
|
+
* console.log(isXZ(Buffer.from('Hello'))); // false
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
export declare function isXZ(buffer: Buffer): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Get the runtime version of liblzma as a string.
|
|
294
|
+
* @returns Version string like "5.4.1"
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* console.log(versionString()); // "5.4.1"
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
export declare function versionString(): string;
|
|
301
|
+
/**
|
|
302
|
+
* Get the runtime version of liblzma as a number.
|
|
303
|
+
* Format: MAJOR * 10000000 + MINOR * 10000 + PATCH * 10
|
|
304
|
+
* @returns Version number (e.g., 50040010 for 5.4.1)
|
|
305
|
+
* @example
|
|
306
|
+
* ```ts
|
|
307
|
+
* console.log(versionNumber()); // 50040010
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
export declare function versionNumber(): number;
|
|
311
|
+
/**
|
|
312
|
+
* Get the memory usage estimate for encoding with a given preset.
|
|
313
|
+
* @param presetLevel - Compression preset (0-9, optionally OR'd with preset.EXTREME)
|
|
314
|
+
* @returns Memory usage in bytes, or 0 if preset is invalid
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* console.log(easyEncoderMemusage(6)); // ~104857600 (100 MB)
|
|
318
|
+
* console.log(easyEncoderMemusage(9 | preset.EXTREME)); // ~712507392 (680 MB)
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
export declare function easyEncoderMemusage(presetLevel: number): number;
|
|
322
|
+
/**
|
|
323
|
+
* Get the memory usage estimate for decoding.
|
|
324
|
+
* @returns Memory usage in bytes for decoder initialization
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* console.log(easyDecoderMemusage()); // ~18874368 (18 MB)
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
export declare function easyDecoderMemusage(): number;
|
|
331
|
+
/**
|
|
332
|
+
* Metadata extracted from an XZ file index.
|
|
333
|
+
*/
|
|
334
|
+
export interface XZFileIndex {
|
|
335
|
+
/** Uncompressed size in bytes */
|
|
336
|
+
uncompressedSize: number;
|
|
337
|
+
/** Compressed size in bytes (excluding headers) */
|
|
338
|
+
compressedSize: number;
|
|
339
|
+
/** Number of streams in the file */
|
|
340
|
+
streamCount: number;
|
|
341
|
+
/** Number of blocks in the file */
|
|
342
|
+
blockCount: number;
|
|
343
|
+
/** Integrity check type (see check.CRC32, check.CRC64, etc.) */
|
|
344
|
+
check: number;
|
|
345
|
+
/** Memory usage of the index structure */
|
|
346
|
+
memoryUsage: number;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Parse the index from a complete XZ file buffer to get metadata.
|
|
350
|
+
* This allows you to know the uncompressed size before decompressing.
|
|
351
|
+
* @param buffer - Complete XZ file buffer
|
|
352
|
+
* @returns Object with file metadata
|
|
353
|
+
* @throws Error if buffer is not a valid XZ stream
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* const compressed = await xzAsync(largeBuffer);
|
|
357
|
+
* const info = parseFileIndex(compressed);
|
|
358
|
+
* console.log(`Uncompressed: ${info.uncompressedSize}, Compressed: ${info.compressedSize}`);
|
|
359
|
+
* console.log(`Ratio: ${(info.compressedSize / info.uncompressedSize * 100).toFixed(1)}%`);
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
export declare function parseFileIndex(buffer: Buffer): XZFileIndex;
|
|
363
|
+
/**
|
|
364
|
+
* Human-readable error messages for LZMA status codes.
|
|
365
|
+
*/
|
|
139
366
|
export declare enum LZMAErrorMessage {
|
|
140
367
|
SUCCESS = "Operation completed successfully",
|
|
141
368
|
STREAM_END = "End of stream was reached",
|
|
@@ -150,14 +377,89 @@ export declare enum LZMAErrorMessage {
|
|
|
150
377
|
BUF_ERROR = "No progress is possible",
|
|
151
378
|
PROG_ERROR = "Programming error"
|
|
152
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Array of error messages indexed by LZMA status code.
|
|
382
|
+
* @deprecated Use LZMAErrorMessage enum instead
|
|
383
|
+
*/
|
|
153
384
|
export declare const messages: readonly string[];
|
|
385
|
+
/**
|
|
386
|
+
* Decompress a buffer asynchronously using callback.
|
|
387
|
+
* @param buffer - Compressed data to decompress
|
|
388
|
+
* @param callback - Callback with error or decompressed data
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```ts
|
|
392
|
+
* unxz(compressedBuffer, (err, result) => {
|
|
393
|
+
* if (err) throw err;
|
|
394
|
+
* console.log(result.toString());
|
|
395
|
+
* });
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
154
398
|
export declare function unxz(buffer: Buffer | string, callback: CompressionCallback): void;
|
|
155
399
|
export declare function unxz(buffer: Buffer | string, opts: LZMAOptions, callback: CompressionCallback): void;
|
|
400
|
+
/**
|
|
401
|
+
* Decompress a buffer synchronously.
|
|
402
|
+
* @param buffer - Compressed data to decompress
|
|
403
|
+
* @param opts - LZMA decompression options
|
|
404
|
+
* @returns Decompressed data buffer
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* ```ts
|
|
408
|
+
* const decompressed = unxzSync(compressedBuffer);
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
156
411
|
export declare function unxzSync(buffer: Buffer | string, opts?: LZMAOptions): Buffer;
|
|
412
|
+
/**
|
|
413
|
+
* Compress a buffer asynchronously using callback.
|
|
414
|
+
* @param buffer - Data to compress
|
|
415
|
+
* @param callback - Callback with error or compressed data
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```ts
|
|
419
|
+
* xz(data, { preset: 6 }, (err, result) => {
|
|
420
|
+
* if (err) throw err;
|
|
421
|
+
* fs.writeFileSync('data.xz', result);
|
|
422
|
+
* });
|
|
423
|
+
* ```
|
|
424
|
+
*/
|
|
157
425
|
export declare function xz(buffer: Buffer | string, callback: CompressionCallback): void;
|
|
158
426
|
export declare function xz(buffer: Buffer | string, opts: LZMAOptions, callback: CompressionCallback): void;
|
|
427
|
+
/**
|
|
428
|
+
* Compress a buffer synchronously.
|
|
429
|
+
* @param buffer - Data to compress
|
|
430
|
+
* @param opts - LZMA compression options
|
|
431
|
+
* @returns Compressed data buffer
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* const compressed = xzSync(data, { preset: 9 });
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
159
438
|
export declare function xzSync(buffer: Buffer | string, opts?: LZMAOptions): Buffer;
|
|
439
|
+
/**
|
|
440
|
+
* Compress a buffer asynchronously using Promise.
|
|
441
|
+
* @param buffer - Data to compress
|
|
442
|
+
* @param opts - LZMA compression options
|
|
443
|
+
* @returns Promise resolving to compressed data buffer
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* const compressed = await xzAsync(data, { preset: 6 });
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
160
450
|
export declare function xzAsync(buffer: Buffer | string, opts?: LZMAOptions): Promise<Buffer>;
|
|
451
|
+
/**
|
|
452
|
+
* Decompress a buffer asynchronously using Promise.
|
|
453
|
+
* @param buffer - Compressed data to decompress
|
|
454
|
+
* @param opts - LZMA decompression options
|
|
455
|
+
* @returns Promise resolving to decompressed data buffer
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```ts
|
|
459
|
+
* const decompressed = await unxzAsync(compressedBuffer);
|
|
460
|
+
* console.log(decompressed.toString());
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
161
463
|
export declare function unxzAsync(buffer: Buffer | string, opts?: LZMAOptions): Promise<Buffer>;
|
|
162
464
|
/**
|
|
163
465
|
* Compress a file using XZ compression
|
|
@@ -188,26 +490,41 @@ declare const _default: {
|
|
|
188
490
|
readonly SHA256: any;
|
|
189
491
|
};
|
|
190
492
|
preset: {
|
|
493
|
+
/** Default compression level (6) */
|
|
191
494
|
readonly DEFAULT: any;
|
|
495
|
+
/** Extreme mode flag - slower but better compression */
|
|
192
496
|
readonly EXTREME: any;
|
|
193
497
|
};
|
|
194
498
|
flag: {
|
|
499
|
+
/** Tell decoder if input has no integrity check */
|
|
195
500
|
readonly TELL_NO_CHECK: any;
|
|
501
|
+
/** Tell decoder if integrity check is unsupported */
|
|
196
502
|
readonly TELL_UNSUPPORTED_CHECK: any;
|
|
503
|
+
/** Tell decoder about any integrity check type */
|
|
197
504
|
readonly TELL_ANY_CHECK: any;
|
|
505
|
+
/** Allow concatenated XZ streams */
|
|
198
506
|
readonly CONCATENATED: any;
|
|
199
507
|
};
|
|
200
508
|
filter: {
|
|
509
|
+
/** LZMA2 compression filter (required, must be last) */
|
|
201
510
|
readonly LZMA2: any;
|
|
511
|
+
/** BCJ filter for x86 executables */
|
|
202
512
|
readonly X86: any;
|
|
513
|
+
/** BCJ filter for PowerPC executables */
|
|
203
514
|
readonly POWERPC: any;
|
|
515
|
+
/** BCJ filter for IA-64 executables */
|
|
204
516
|
readonly IA64: any;
|
|
517
|
+
/** BCJ filter for ARM executables */
|
|
205
518
|
readonly ARM: any;
|
|
519
|
+
/** BCJ filter for ARM-Thumb executables */
|
|
206
520
|
readonly ARMTHUMB: any;
|
|
521
|
+
/** BCJ filter for SPARC executables */
|
|
207
522
|
readonly SPARC: any;
|
|
208
523
|
};
|
|
209
524
|
mode: {
|
|
525
|
+
/** Fast compression mode - less memory, faster */
|
|
210
526
|
readonly FAST: any;
|
|
527
|
+
/** Normal compression mode - better ratio */
|
|
211
528
|
readonly NORMAL: any;
|
|
212
529
|
};
|
|
213
530
|
createXz: typeof createXz;
|
package/lib/lzma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lzma.d.ts","sourceRoot":"","sources":["../src/lzma.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAEL,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,WAAW,EACX,cAAc,EACd,QAAQ,EACR,UAAU,
|
|
1
|
+
{"version":3,"file":"lzma.d.ts","sourceRoot":"","sources":["../src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