node-liblzma 2.0.0 → 2.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 (67) hide show
  1. package/README.md +156 -63
  2. package/binding.gyp +7 -2
  3. package/index.d.ts +26 -3
  4. package/lib/errors.d.ts.map +1 -1
  5. package/lib/errors.js +26 -15
  6. package/lib/errors.js.map +1 -1
  7. package/lib/lzma.d.ts +236 -2
  8. package/lib/lzma.d.ts.map +1 -1
  9. package/lib/lzma.js +225 -39
  10. package/lib/lzma.js.map +1 -1
  11. package/lib/pool.d.ts.map +1 -1
  12. package/lib/pool.js +9 -3
  13. package/lib/pool.js.map +1 -1
  14. package/lib/types.d.ts +68 -1
  15. package/lib/types.d.ts.map +1 -1
  16. package/package.json +34 -17
  17. package/scripts/build_xz_with_cmake.py +23 -26
  18. package/scripts/download_xz_from_github.py +14 -13
  19. package/src/bindings/node-liblzma.cpp +40 -4
  20. package/src/bindings/node-liblzma.hpp +2 -1
  21. package/xz-version.json +3 -3
  22. package/.claude/settings.local.json +0 -92
  23. package/.gitattributes +0 -3
  24. package/.release-it.json +0 -6
  25. package/CHANGELOG.md +0 -209
  26. package/History.md +0 -79
  27. package/RELEASING.md +0 -131
  28. package/biome.json +0 -81
  29. package/coverage/base.css +0 -224
  30. package/coverage/block-navigation.js +0 -87
  31. package/coverage/errors.ts.html +0 -586
  32. package/coverage/favicon.png +0 -0
  33. package/coverage/index.html +0 -146
  34. package/coverage/lcov-report/base.css +0 -224
  35. package/coverage/lcov-report/block-navigation.js +0 -87
  36. package/coverage/lcov-report/errors.ts.html +0 -586
  37. package/coverage/lcov-report/favicon.png +0 -0
  38. package/coverage/lcov-report/index.html +0 -146
  39. package/coverage/lcov-report/lzma.ts.html +0 -2596
  40. package/coverage/lcov-report/pool.ts.html +0 -769
  41. package/coverage/lcov-report/prettify.css +0 -1
  42. package/coverage/lcov-report/prettify.js +0 -2
  43. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  44. package/coverage/lcov-report/sorter.js +0 -210
  45. package/coverage/lcov.info +0 -636
  46. package/coverage/lzma.ts.html +0 -2596
  47. package/coverage/pool.ts.html +0 -769
  48. package/coverage/prettify.css +0 -1
  49. package/coverage/prettify.js +0 -2
  50. package/coverage/sort-arrow-sprite.png +0 -0
  51. package/coverage/sorter.js +0 -210
  52. package/coverage-reports/assets/monocart-coverage-app.js +0 -2
  53. package/coverage-reports/coverage-data.js +0 -1
  54. package/coverage-reports/index.html +0 -48
  55. package/err.log +0 -26
  56. package/pnpm-workspace.yaml +0 -3
  57. package/scripts/analyze-coverage.js +0 -132
  58. package/scripts/compare-coverage-tools.js +0 -93
  59. package/scripts/prebuildify.py +0 -13
  60. package/src/errors.ts +0 -167
  61. package/src/lzma.ts +0 -839
  62. package/src/pool.ts +0 -228
  63. package/src/types.ts +0 -30
  64. package/tsconfig.json +0 -50
  65. package/vitest.config.istanbul.ts +0 -29
  66. package/vitest.config.monocart.ts +0 -44
  67. package/vitest.config.ts +0 -44
package/src/errors.ts DELETED
@@ -1,167 +0,0 @@
1
- /**
2
- * node-liblzma - Node.js bindings for liblzma
3
- * Copyright (C) Olivier Orabona <olivier.orabona@gmail.com>
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Lesser General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public License
16
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
- */
18
-
19
- /**
20
- * Base class for all LZMA-related errors
21
- */
22
- export class LZMAError extends Error {
23
- public readonly errno: number;
24
- public readonly code: number;
25
-
26
- constructor(message: string, errno: number) {
27
- super(message);
28
- this.name = 'LZMAError';
29
- this.errno = errno;
30
- this.code = errno;
31
- Error.captureStackTrace(this, this.constructor);
32
- }
33
- }
34
-
35
- /**
36
- * Memory allocation error - thrown when LZMA cannot allocate required memory
37
- */
38
- export class LZMAMemoryError extends LZMAError {
39
- constructor(errno: number) {
40
- super('Cannot allocate memory', errno);
41
- this.name = 'LZMAMemoryError';
42
- }
43
- }
44
-
45
- /**
46
- * Memory limit error - thrown when operation would exceed memory usage limit
47
- */
48
- export class LZMAMemoryLimitError extends LZMAError {
49
- constructor(errno: number) {
50
- super('Memory usage limit was reached', errno);
51
- this.name = 'LZMAMemoryLimitError';
52
- }
53
- }
54
-
55
- /**
56
- * Format error - thrown when file format is not recognized
57
- */
58
- export class LZMAFormatError extends LZMAError {
59
- constructor(errno: number) {
60
- super('File format not recognized', errno);
61
- this.name = 'LZMAFormatError';
62
- }
63
- }
64
-
65
- /**
66
- * Options error - thrown when invalid or unsupported options are provided
67
- */
68
- export class LZMAOptionsError extends LZMAError {
69
- constructor(errno: number) {
70
- super('Invalid or unsupported options', errno);
71
- this.name = 'LZMAOptionsError';
72
- }
73
- }
74
-
75
- /**
76
- * Data error - thrown when compressed data is corrupt
77
- */
78
- export class LZMADataError extends LZMAError {
79
- constructor(errno: number) {
80
- super('Data is corrupt', errno);
81
- this.name = 'LZMADataError';
82
- }
83
- }
84
-
85
- /**
86
- * Buffer error - thrown when no progress is possible (e.g., buffer too small)
87
- */
88
- export class LZMABufferError extends LZMAError {
89
- constructor(errno: number) {
90
- super('No progress is possible', errno);
91
- this.name = 'LZMABufferError';
92
- }
93
- }
94
-
95
- /**
96
- * Programming error - thrown when there's an internal programming error
97
- */
98
- export class LZMAProgrammingError extends LZMAError {
99
- constructor(errno: number) {
100
- super('Programming error', errno);
101
- this.name = 'LZMAProgrammingError';
102
- }
103
- }
104
-
105
- /**
106
- * Factory function to create appropriate error instance based on errno
107
- */
108
- export function createLZMAError(errno: number, message?: string): LZMAError {
109
- // LZMA error codes mapping
110
- const LZMA_OK = 0;
111
- const LZMA_STREAM_END = 1;
112
- const LZMA_NO_CHECK = 2;
113
- const LZMA_UNSUPPORTED_CHECK = 3;
114
- const LZMA_GET_CHECK = 4;
115
- const LZMA_MEM_ERROR = 5;
116
- const LZMA_MEMLIMIT_ERROR = 6;
117
- const LZMA_FORMAT_ERROR = 7;
118
- const LZMA_OPTIONS_ERROR = 8;
119
- const LZMA_DATA_ERROR = 9;
120
- const LZMA_BUF_ERROR = 10;
121
- const LZMA_PROG_ERROR = 11;
122
-
123
- switch (errno) {
124
- case LZMA_MEM_ERROR:
125
- return new LZMAMemoryError(errno);
126
- case LZMA_MEMLIMIT_ERROR:
127
- return new LZMAMemoryLimitError(errno);
128
- case LZMA_FORMAT_ERROR:
129
- return new LZMAFormatError(errno);
130
- case LZMA_OPTIONS_ERROR:
131
- return new LZMAOptionsError(errno);
132
- case LZMA_DATA_ERROR:
133
- return new LZMADataError(errno);
134
- case LZMA_BUF_ERROR:
135
- return new LZMABufferError(errno);
136
- case LZMA_PROG_ERROR:
137
- return new LZMAProgrammingError(errno);
138
- default: {
139
- // For success codes and unknown errors, use base LZMAError
140
- const errorMessage = message || getErrorMessage(errno);
141
- return new LZMAError(errorMessage, errno);
142
- }
143
- }
144
- }
145
-
146
- /**
147
- * Get error message for a given errno
148
- */
149
- function getErrorMessage(errno: number): string {
150
- const messages = [
151
- 'Operation completed successfully',
152
- 'End of stream was reached',
153
- 'Input stream has no integrity check',
154
- 'Cannot calculate the integrity check',
155
- 'Integrity check type is not available',
156
- 'Cannot allocate memory',
157
- 'Memory usage limit was reached',
158
- 'File format not recognized',
159
- 'Invalid or unsupported options',
160
- 'Data is corrupt',
161
- 'No progress is possible',
162
- 'Programming error',
163
- ];
164
-
165
- const messageIndex = Math.max(0, Math.min(errno, messages.length - 1));
166
- return messages[messageIndex];
167
- }