node-liblzma 1.1.4 → 1.1.7

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/lib/lzma.js ADDED
@@ -0,0 +1,384 @@
1
+ // Generated by CoffeeScript 2.6.1
2
+ (function() {
3
+ /*
4
+ * node-liblzma - Node.js bindings for liblzma
5
+ * Copyright (C) Olivier Orabona <olivier.orabona@gmail.com>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ var Transform, Unxz, Xz, XzStream, assert, binding_path, liblzma, maxThreads, os, path, util, xzBuffer, xzBufferSync;
21
+
22
+ path = require('path');
23
+
24
+ binding_path = path.resolve(path.join(__dirname, '..'));
25
+
26
+ liblzma = require('node-gyp-build')(binding_path);
27
+
28
+ util = require('util');
29
+
30
+ assert = require('assert');
31
+
32
+ os = require('os');
33
+
34
+ ({Transform} = require('stream'));
35
+
36
+ // Should not change over time... :)
37
+ maxThreads = os.cpus().length;
38
+
39
+ XzStream = class XzStream extends Transform {
40
+ constructor(mode, _opts = {}, options) {
41
+ var base, base1, base2, base3, base4;
42
+ super(options);
43
+ this._opts = _opts;
44
+ if ((base = this._opts).check == null) {
45
+ base.check = exports.check.NONE;
46
+ }
47
+ if ((base1 = this._opts).preset == null) {
48
+ base1.preset = exports.preset.DEFAULT;
49
+ }
50
+ if ((base2 = this._opts).filters == null) {
51
+ base2.filters = [exports.filter.LZMA2];
52
+ }
53
+ if ((base3 = this._opts).mode == null) {
54
+ base3.mode = exports.mode.NORMAL;
55
+ }
56
+ if ((base4 = this._opts).threads == null) {
57
+ base4.threads = 1;
58
+ }
59
+ this._chunkSize = this._opts.chunkSize ? this._opts.chunkSize : liblzma.BUFSIZ;
60
+ // By default no flush, since there is no LZMA_NO_SYNC, we stick to
61
+ // default LZMA_RUN (0)
62
+ this._flushFlag = this._opts.flushFlag || liblzma.LZMA_RUN;
63
+ assert(Array.isArray(this._opts.filters), "Filters need to be in an array!");
64
+ // Add default filter LZMA2 if none provided
65
+ if (this._opts.filters.indexOf(exports.filter.LZMA2) === -1) {
66
+ this._opts.filters.push(exports.filter.LZMA2);
67
+ }
68
+ // Multithreading is only available for encoding, so if we are encoding, check
69
+ // opts threads value.
70
+ if (mode === liblzma.STREAM_ENCODE) {
71
+ if (!liblzma.HAS_THREADS_SUPPORT) {
72
+ this._opts.threads = 1;
73
+ }
74
+ // By default set to maximum available processors
75
+ if (this._opts.threads === 0) {
76
+ this._opts.threads = maxThreads;
77
+ }
78
+ }
79
+ // Initialize engine
80
+ this.lzma = new liblzma.LZMA(mode, this._opts);
81
+ this._closed = false;
82
+ this._hadError = false;
83
+ this._offset = 0;
84
+ this._buffer = Buffer.alloc(this._chunkSize);
85
+ this.on('onerror', (errno) => {
86
+ var error;
87
+ this._hadError = true;
88
+ error = new Error(exports.messages[errno]);
89
+ error.errno = errno;
90
+ error.code = errno;
91
+ return this.emit('error', error);
92
+ });
93
+ this.once('end', this.close);
94
+ }
95
+
96
+ flush(kind, callback) {
97
+ var ws;
98
+ ws = this._writableState;
99
+ if (typeof kind === 'function' || (typeof kind === 'undefined' && !callback)) {
100
+ [callback, kind] = [kind, liblzma.LZMA_SYNC_FLUSH];
101
+ }
102
+ if (ws.ended) {
103
+ if (callback) {
104
+ process.nextTick(callback);
105
+ }
106
+ } else if (ws.ending) {
107
+ if (callback) {
108
+ this.once('end', callback);
109
+ }
110
+ } else if (ws.needDrain) {
111
+ this.once('drain', () => {
112
+ this.flush(callback);
113
+ });
114
+ } else {
115
+ this._flushFlag = kind;
116
+ this.write(Buffer.alloc(0), '', callback);
117
+ }
118
+ }
119
+
120
+ close(callback) {
121
+ if (callback) {
122
+ process.nextTick(callback);
123
+ }
124
+ // We will trigger this case with #xz and #unxz
125
+ if (this._closed) {
126
+ return;
127
+ }
128
+ this.lzma.close();
129
+ this._closed = true;
130
+ process.nextTick(() => {
131
+ this.emit('close');
132
+ });
133
+ }
134
+
135
+ _transform(chunk, encoding, callback) {
136
+ var ending, flushFlag, last, ws;
137
+ flushFlag = void 0;
138
+ ws = this._writableState;
139
+ ending = ws.ending || ws.ended;
140
+ last = ending && (!chunk || ws.length === chunk.length);
141
+ if (chunk !== null && !(chunk instanceof Buffer)) {
142
+ return callback(new Error("invalid input"));
143
+ }
144
+ if (this._closed) {
145
+ return callback(new Error("lzma binding closed"));
146
+ }
147
+ // If it's the last chunk, or a final flush, we use the LZMA_FINISH flush flag.
148
+ // If it's explicitly flushing at some other time, then we use
149
+ // LZMA_SYNC_FLUSH.
150
+ if (last) {
151
+ flushFlag = liblzma.LZMA_FINISH;
152
+ } else {
153
+ flushFlag = this._flushFlag;
154
+ if (chunk.length >= ws.length) {
155
+ // once we've flushed the last of the queue, stop flushing and
156
+ // go back to the normal behavior.
157
+ this._flushFlag = this._opts.flushFlag || liblzma.LZMA_RUN;
158
+ }
159
+ }
160
+ this._processChunk(chunk, flushFlag, callback);
161
+ }
162
+
163
+ _flush(callback) {
164
+ this._transform(Buffer.alloc(0), '', callback);
165
+ }
166
+
167
+ _processChunk(chunk, flushFlag, cb) {
168
+ var async, availInBefore, availOutBefore, buf, buffers, callback, error, inOff, nread, res;
169
+ // If user setting async is set to true, then it will all depend on whether
170
+ // we can actually be async, or not. If user set explicitly async to false
171
+ // then whether we have a callback or not becomes irrelevant..
172
+ // TODO: Works in v0.11
173
+ //async = util.isFunction cb
174
+ // until then...
175
+ async = typeof cb === 'function';
176
+ // Sanity checks
177
+ assert(!this._closed, "Stream closed!");
178
+ availInBefore = chunk && chunk.length;
179
+ availOutBefore = this._chunkSize - this._offset;
180
+ inOff = 0;
181
+ // So far it looks like Zlib _processChunk in CoffeeScript. But to make C++
182
+ // code easier when it comes to emitting events and callback calling sync/async
183
+ // we handle error codes here. If anything wrong is returned, we emit event
184
+ // and return false in case we are synchronous.
185
+ callback = (errno, availInAfter, availOutAfter) => {
186
+ var out, used;
187
+ if (this._hadError) {
188
+ return;
189
+ }
190
+ // if LZMA engine returned something else, we are running into trouble!
191
+ if (errno !== liblzma.LZMA_OK && errno !== liblzma.LZMA_STREAM_END) {
192
+ this.emit('onerror', errno);
193
+ return false;
194
+ }
195
+ used = availOutBefore - availOutAfter;
196
+ assert(used >= 0, `More bytes after than before! Delta = ${used}`);
197
+ if (used > 0) {
198
+ out = this._buffer.slice(this._offset, this._offset + used);
199
+ this._offset += used;
200
+ if (async) {
201
+ this.push(out);
202
+ } else {
203
+ buffers.push(out);
204
+ nread += used;
205
+ }
206
+ }
207
+ // exhausted the output buffer, or used all the input create a new one.
208
+ if (availOutAfter === 0 || this._offset >= this._chunkSize) {
209
+ availOutBefore = this._chunkSize;
210
+ this._offset = 0;
211
+ this._buffer = Buffer.alloc(this._chunkSize);
212
+ }
213
+ if (availOutAfter === 0 || availInAfter > 0) {
214
+ inOff += availInBefore - availInAfter;
215
+ availInBefore = availInAfter;
216
+ if (!async) {
217
+ return true;
218
+ }
219
+ this.lzma.code(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, callback);
220
+ return;
221
+ }
222
+ if (!async) {
223
+ return false;
224
+ }
225
+ cb();
226
+ };
227
+ if (!async) {
228
+ // Doing it synchronously
229
+ buffers = [];
230
+ nread = 0;
231
+ error = null;
232
+ this.on('error', function(e) {
233
+ return error = e;
234
+ });
235
+ while (true) {
236
+ res = this.lzma.codeSync(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset);
237
+ if (!(!this._hadError && callback(res[0], res[1], res[2]))) {
238
+ break;
239
+ }
240
+ }
241
+ if (this._hadError) {
242
+ throw error;
243
+ }
244
+ this.close();
245
+ buf = Buffer.concat(buffers, nread);
246
+ return buf;
247
+ }
248
+ this.lzma.code(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, callback);
249
+ }
250
+
251
+ };
252
+
253
+ Xz = class Xz extends XzStream {
254
+ constructor(lzma_options, options) {
255
+ super(liblzma.STREAM_ENCODE, lzma_options, options);
256
+ }
257
+
258
+ };
259
+
260
+ Unxz = class Unxz extends XzStream {
261
+ constructor(lzma_options, options) {
262
+ super(liblzma.STREAM_DECODE, lzma_options, options);
263
+ }
264
+
265
+ };
266
+
267
+ exports.Xz = Xz;
268
+
269
+ exports.Unxz = Unxz;
270
+
271
+ exports.hasThreads = function() {
272
+ return liblzma.HAS_THREADS_SUPPORT;
273
+ };
274
+
275
+ exports.messages = ["Operation completed successfully", "End of stream was reached", "Input stream has no integrity check", "Cannot calculate the integrity check", "Integrity check type is not available", "Cannot allocate memory", "Memory usage limit was reached", "File format not recognized", "Invalid or unsupported options", "Data is corrupt", "No progress is possible", "Programming error"];
276
+
277
+ exports.check = {
278
+ "NONE": liblzma.LZMA_CHECK_NONE,
279
+ "CRC32": liblzma.LZMA_CHECK_CRC32,
280
+ "CRC64": liblzma.LZMA_CHECK_CRC64,
281
+ "SHA256": liblzma.LZMA_CHECK_SHA256
282
+ };
283
+
284
+ exports.preset = {
285
+ "DEFAULT": liblzma.LZMA_PRESET_DEFAULT,
286
+ "EXTREME": liblzma.LZMA_PRESET_EXTREME
287
+ };
288
+
289
+ exports.flag = {
290
+ "TELL_NO_CHECK": liblzma.LZMA_TELL_NO_CHECK,
291
+ "TELL_UNSUPPORTED_CHECK": liblzma.LZMA_TELL_UNSUPPORTED_CHECK,
292
+ "TELL_ANY_CHECK": liblzma.LZMA_TELL_ANY_CHECK,
293
+ "CONCATENATED": liblzma.LZMA_CONCATENATED
294
+ };
295
+
296
+ exports.filter = {
297
+ "LZMA2": liblzma.LZMA_FILTER_LZMA2,
298
+ "X86": liblzma.LZMA_FILTER_X86,
299
+ "POWERPC": liblzma.LZMA_FILTER_POWERPC,
300
+ "IA64": liblzma.LZMA_FILTER_IA64,
301
+ "ARM": liblzma.LZMA_FILTER_ARM,
302
+ "ARMTHUMB": liblzma.LZMA_FILTER_ARMTHUMB,
303
+ "SPARC": liblzma.LZMA_FILTER_SPARC
304
+ };
305
+
306
+ exports.mode = {
307
+ "FAST": liblzma.LZMA_MODE_FAST,
308
+ "NORMAL": liblzma.LZMA_MODE_NORMAL
309
+ };
310
+
311
+ exports.createXz = function(lzma_options, options) {
312
+ return new Xz(lzma_options, options);
313
+ };
314
+
315
+ exports.createUnxz = function(lzma_options, options) {
316
+ return new Unxz(lzma_options, options);
317
+ };
318
+
319
+ exports.unxz = function(buffer, opts, callback) {
320
+ if (typeof opts === 'function') {
321
+ [callback, opts] = [opts, {}];
322
+ }
323
+ return xzBuffer(new Unxz(opts), buffer, callback);
324
+ };
325
+
326
+ exports.unxzSync = function(buffer, opts) {
327
+ return xzBufferSync(new Unxz(opts), buffer);
328
+ };
329
+
330
+ exports.xz = function(buffer, opts, callback) {
331
+ if (typeof opts === 'function') {
332
+ [callback, opts] = [opts, {}];
333
+ }
334
+ return xzBuffer(new Xz(opts), buffer, callback);
335
+ };
336
+
337
+ exports.xzSync = function(buffer, opts) {
338
+ return xzBufferSync(new Xz(opts), buffer);
339
+ };
340
+
341
+ xzBuffer = function(engine, buffer, callback) {
342
+ var buffers, flow, nread, onEnd, onError;
343
+ buffers = [];
344
+ nread = 0;
345
+ flow = function() {
346
+ var chunk;
347
+ chunk = void 0;
348
+ while (null !== (chunk = engine.read())) {
349
+ buffers.push(chunk);
350
+ nread += chunk.length;
351
+ }
352
+ engine.once('readable', flow);
353
+ };
354
+ onEnd = function() {
355
+ var buf;
356
+ buf = Buffer.concat(buffers, nread);
357
+ buffers = [];
358
+ callback(null, buf);
359
+ engine.close();
360
+ };
361
+ onError = function(err) {
362
+ engine.removeListener('end', onEnd);
363
+ engine.removeListener('readable', flow);
364
+ callback(err);
365
+ };
366
+ engine.on('error', onError);
367
+ engine.on('end', onEnd);
368
+ engine.end(buffer);
369
+ flow();
370
+ };
371
+
372
+ xzBufferSync = function(engine, buffer) {
373
+ if (typeof buffer === 'string') {
374
+ buffer = Buffer.from(buffer);
375
+ }
376
+ if (!(buffer instanceof Buffer)) {
377
+ throw new TypeError("Not a string or buffer");
378
+ }
379
+ return engine._processChunk(buffer, liblzma.LZMA_FINISH);
380
+ };
381
+
382
+ module.exports = exports;
383
+
384
+ }).call(this);
package/package.json CHANGED
@@ -1,26 +1,23 @@
1
1
  {
2
2
  "name": "node-liblzma",
3
- "version": "1.1.4",
3
+ "version": "1.1.7",
4
4
  "description": "NodeJS wrapper for liblzma",
5
5
  "main": "./lib/lzma.js",
6
6
  "scripts": {
7
- "install": "node-gyp install",
8
- "postinstall": "run-p build:*",
9
- "build:native": "node-gyp rebuild",
10
- "build:coffee": "coffee --compile --output lib/ src/",
11
- "rebuild": "node-gyp rebuild",
12
- "test": "npx mocha test/*.coffee"
7
+ "install": "node-gyp-build",
8
+ "prepare": "npx ynpx coffeescript --compile --output lib/ src/",
9
+ "prebuildify": "npx prebuildify --napi --strip -t $(node -v)",
10
+ "prebuildify:win": "for /f \"usebackq tokens=*\" %v in (`node -v`) do npx prebuildify -t %v --napi --strip",
11
+ "test": "mocha test/*.coffee"
13
12
  },
14
13
  "dependencies": {
15
14
  "node-addon-api": "4.2.0",
16
- "node-gyp-build": "4.3.0",
17
- "npm-run-all": "4.1.5"
15
+ "node-gyp-build": "4.3.0"
18
16
  },
19
17
  "devDependencies": {
20
18
  "coffeescript": "2.6.1",
21
19
  "expect.js": "0.3.1",
22
20
  "mocha": "9.2.1",
23
- "node-gyp": "8.4.1",
24
21
  "tsd": "0.19.1"
25
22
  },
26
23
  "types": "index.d.ts",
Binary file
Binary file
Binary file
@@ -1,107 +0,0 @@
1
- /**
2
- * node-liblzma - Node.js bindings for liblzma
3
- * Copyright (C) 2014-2015 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
- #include "node-liblzma.hpp"
20
-
21
- Napi::Object Init(Napi::Env env, Napi::Object exports)
22
- {
23
- LZMA::Init(env, exports);
24
-
25
- // Constants
26
- // enum lzma_ret
27
- exports.Set(Napi::String::New(env, "LZMA_OK"), Napi::Number::New(env, LZMA_OK));
28
- exports.Set(Napi::String::New(env, "LZMA_STREAM_END"), Napi::Number::New(env, LZMA_STREAM_END));
29
- exports.Set(Napi::String::New(env, "LZMA_NO_CHECK"), Napi::Number::New(env, LZMA_NO_CHECK));
30
- exports.Set(Napi::String::New(env, "LZMA_UNSUPPORTED_CHECK"), Napi::Number::New(env, LZMA_UNSUPPORTED_CHECK));
31
- exports.Set(Napi::String::New(env, "LZMA_GET_CHECK"), Napi::Number::New(env, LZMA_GET_CHECK));
32
- exports.Set(Napi::String::New(env, "LZMA_MEM_ERROR"), Napi::Number::New(env, LZMA_MEM_ERROR));
33
- exports.Set(Napi::String::New(env, "LZMA_MEMLIMIT_ERROR"), Napi::Number::New(env, LZMA_MEMLIMIT_ERROR));
34
- exports.Set(Napi::String::New(env, "LZMA_FORMAT_ERROR"), Napi::Number::New(env, LZMA_FORMAT_ERROR));
35
- exports.Set(Napi::String::New(env, "LZMA_OPTIONS_ERROR"), Napi::Number::New(env, LZMA_OPTIONS_ERROR));
36
- exports.Set(Napi::String::New(env, "LZMA_DATA_ERROR"), Napi::Number::New(env, LZMA_DATA_ERROR));
37
- exports.Set(Napi::String::New(env, "LZMA_BUF_ERROR"), Napi::Number::New(env, LZMA_BUF_ERROR));
38
- exports.Set(Napi::String::New(env, "LZMA_PROG_ERROR"), Napi::Number::New(env, LZMA_PROG_ERROR));
39
-
40
- // enum lzma_action
41
- exports.Set(Napi::String::New(env, "LZMA_RUN"), Napi::Number::New(env, LZMA_RUN));
42
- exports.Set(Napi::String::New(env, "LZMA_SYNC_FLUSH"), Napi::Number::New(env, LZMA_SYNC_FLUSH));
43
- exports.Set(Napi::String::New(env, "LZMA_FULL_FLUSH"), Napi::Number::New(env, LZMA_FULL_FLUSH));
44
- exports.Set(Napi::String::New(env, "LZMA_FINISH"), Napi::Number::New(env, LZMA_FINISH));
45
-
46
- // enum lzma_check
47
- exports.Set(Napi::String::New(env, "LZMA_CHECK_NONE"), Napi::Number::New(env, LZMA_CHECK_NONE));
48
- exports.Set(Napi::String::New(env, "LZMA_CHECK_CRC32"), Napi::Number::New(env, LZMA_CHECK_CRC32));
49
- exports.Set(Napi::String::New(env, "LZMA_CHECK_CRC64"), Napi::Number::New(env, LZMA_CHECK_CRC64));
50
- exports.Set(Napi::String::New(env, "LZMA_CHECK_SHA256"), Napi::Number::New(env, LZMA_CHECK_SHA256));
51
-
52
- // lzma_match_finder
53
- exports.Set(Napi::String::New(env, "MF_HC3"), Napi::Number::New(env, LZMA_MF_HC3));
54
- exports.Set(Napi::String::New(env, "MF_HC4"), Napi::Number::New(env, LZMA_MF_HC4));
55
- exports.Set(Napi::String::New(env, "MF_BT2"), Napi::Number::New(env, LZMA_MF_BT2));
56
- exports.Set(Napi::String::New(env, "MF_BT3"), Napi::Number::New(env, LZMA_MF_BT3));
57
- exports.Set(Napi::String::New(env, "MF_BT4"), Napi::Number::New(env, LZMA_MF_BT4));
58
-
59
- // lzma_mode
60
- exports.Set(Napi::String::New(env, "LZMA_MODE_FAST"), Napi::Number::New(env, LZMA_MODE_FAST));
61
- exports.Set(Napi::String::New(env, "LZMA_MODE_NORMAL"), Napi::Number::New(env, LZMA_MODE_NORMAL));
62
-
63
- // defines
64
- exports.Set(Napi::String::New(env, "LZMA_FILTER_X86"), Napi::Number::New(env, LZMA_FILTER_X86));
65
- exports.Set(Napi::String::New(env, "LZMA_FILTER_POWERPC"), Napi::Number::New(env, LZMA_FILTER_POWERPC));
66
- exports.Set(Napi::String::New(env, "LZMA_FILTER_IA64"), Napi::Number::New(env, LZMA_FILTER_IA64));
67
- exports.Set(Napi::String::New(env, "LZMA_FILTER_ARM"), Napi::Number::New(env, LZMA_FILTER_ARM));
68
- exports.Set(Napi::String::New(env, "LZMA_FILTER_ARMTHUMB"), Napi::Number::New(env, LZMA_FILTER_ARMTHUMB));
69
- exports.Set(Napi::String::New(env, "LZMA_FILTER_SPARC"), Napi::Number::New(env, LZMA_FILTER_SPARC));
70
- exports.Set(Napi::String::New(env, "LZMA_FILTER_DELTA"), Napi::Number::New(env, LZMA_FILTER_DELTA));
71
- exports.Set(Napi::String::New(env, "LZMA_FILTERS_MAX"), Napi::Number::New(env, LZMA_FILTERS_MAX));
72
- exports.Set(Napi::String::New(env, "LZMA_FILTER_LZMA1"), Napi::Number::New(env, LZMA_FILTER_LZMA1));
73
- exports.Set(Napi::String::New(env, "LZMA_FILTER_LZMA2"), Napi::Number::New(env, LZMA_FILTER_LZMA2));
74
- exports.Set(Napi::String::New(env, "LZMA_VLI_UNKNOWN"), Napi::Number::New(env, LZMA_VLI_UNKNOWN));
75
-
76
- exports.Set(Napi::String::New(env, "LZMA_VLI_BYTES_MAX"), Napi::Number::New(env, LZMA_VLI_BYTES_MAX));
77
- exports.Set(Napi::String::New(env, "LZMA_CHECK_ID_MAX"), Napi::Number::New(env, LZMA_CHECK_ID_MAX));
78
- exports.Set(Napi::String::New(env, "LZMA_CHECK_SIZE_MAX"), Napi::Number::New(env, LZMA_CHECK_SIZE_MAX));
79
- exports.Set(Napi::String::New(env, "LZMA_PRESET_DEFAULT"), Napi::Number::New(env, LZMA_PRESET_DEFAULT));
80
- exports.Set(Napi::String::New(env, "LZMA_PRESET_LEVEL_MASK"), Napi::Number::New(env, LZMA_PRESET_LEVEL_MASK));
81
- exports.Set(Napi::String::New(env, "LZMA_PRESET_EXTREME"), Napi::Number::New(env, LZMA_PRESET_EXTREME));
82
- exports.Set(Napi::String::New(env, "LZMA_TELL_NO_CHECK"), Napi::Number::New(env, LZMA_TELL_NO_CHECK));
83
- exports.Set(Napi::String::New(env, "LZMA_TELL_UNSUPPORTED_CHECK"), Napi::Number::New(env, LZMA_TELL_UNSUPPORTED_CHECK));
84
- exports.Set(Napi::String::New(env, "LZMA_TELL_ANY_CHECK"), Napi::Number::New(env, LZMA_TELL_ANY_CHECK));
85
- exports.Set(Napi::String::New(env, "LZMA_CONCATENATED"), Napi::Number::New(env, LZMA_CONCATENATED));
86
- exports.Set(Napi::String::New(env, "LZMA_STREAM_HEADER_SIZE"), Napi::Number::New(env, LZMA_STREAM_HEADER_SIZE));
87
- exports.Set(Napi::String::New(env, "LZMA_VERSION_MAJOR"), Napi::Number::New(env, LZMA_VERSION_MAJOR));
88
- exports.Set(Napi::String::New(env, "LZMA_VERSION_MINOR"), Napi::Number::New(env, LZMA_VERSION_MINOR));
89
- exports.Set(Napi::String::New(env, "LZMA_VERSION_PATCH"), Napi::Number::New(env, LZMA_VERSION_PATCH));
90
- exports.Set(Napi::String::New(env, "LZMA_VERSION_STABILITY"), Napi::Number::New(env, LZMA_VERSION_STABILITY));
91
- exports.Set(Napi::String::New(env, "LZMA_VERSION_STABILITY_ALPHA"), Napi::Number::New(env, LZMA_VERSION_STABILITY_ALPHA));
92
- exports.Set(Napi::String::New(env, "LZMA_VERSION_STABILITY_BETA"), Napi::Number::New(env, LZMA_VERSION_STABILITY_BETA));
93
- exports.Set(Napi::String::New(env, "LZMA_VERSION_STABILITY_STABLE"), Napi::Number::New(env, LZMA_VERSION_STABILITY_STABLE));
94
- exports.Set(Napi::String::New(env, "LZMA_VERSION"), Napi::Number::New(env, LZMA_VERSION));
95
- exports.Set(Napi::String::New(env, "LZMA_VERSION_STRING"), Napi::String::New(env, LZMA_VERSION_STRING));
96
-
97
- // LZMAStream flags
98
- exports.Set(Napi::String::New(env, "STREAM_ENCODE"), Napi::Number::New(env, STREAM_ENCODE));
99
- exports.Set(Napi::String::New(env, "STREAM_DECODE"), Napi::Number::New(env, STREAM_DECODE));
100
- exports.Set(Napi::String::New(env, "STREAM_ENCODE_MT"), Napi::Number::New(env, STREAM_ENCODE_MT));
101
-
102
- exports.Set(Napi::String::New(env, "BUFSIZ"), Napi::Number::New(env, BUFSIZ));
103
-
104
- return exports;
105
- }
106
-
107
- NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init)