Giter VIP home page Giter VIP logo

lzma-native's Introduction

lzma-native

NPM Version NPM Downloads Build Status Windows Coverage Status Dependency Status devDependency Status

Node.js interface to the native liblzma compression library (.xz file format, among others)

This package provides interfaces for compression and decompression of .xz (and legacy .lzma) files, both stream-based and string-based.

Example usage

Installation

Simply install lzma-native via npm:

$ npm install --save lzma-native

Note: As of version 1.0.0, this module provides pre-built binaries for multiple Node.js versions and all major OS using node-pre-gyp, so for 99 % of users no compiler toolchain is necessary. Please create an issue here if you have any trouble installing this module.

Note: [email protected] requires a Node version >= 4. If you want to support Node 0.10 or 0.12, you can feel free to use [email protected].

For streams

If you don’t have any fancy requirements, using this library is quite simple:

var lzma = require('lzma-native');

var compressor = lzma.createCompressor();
var input = fs.createReadStream('README.md');
var output = fs.createWriteStream('README.md.xz');

input.pipe(compressor).pipe(output);

For decompression, you can simply use lzma.createDecompressor().

Both functions return a stream where you can pipe your input in and read your (de)compressed output from.

For simple strings/Buffers

If you want your input/output to be Buffers (strings will be accepted as input), this even gets a little simpler:

lzma.compress('Banana', function(result) {
    console.log(result); // <Buffer fd 37 7a 58 5a 00 00 01 69 22 de 36 02 00 21 ...>
});

Again, replace lzma.compress with lzma.decompress and you’ll get the inverse transformation.

lzma.compress() and lzma.decompress() will return promises and you don’t need to provide any kind of callback (Example code).

API

Compatibility implementations

Apart from the API described here, lzma-native implements the APIs of the following other LZMA libraries so you can use it nearly as a drop-in replacement:

  • node-xz via lzma.Compressor and lzma.Decompressor
  • LZMA-JS via lzma.LZMA().compress and lzma.LZMA().decompress, though without actual support for progress functions and returning Buffer objects instead of integer arrays. (This produces output in the .lzma file format, not the .xz format!)

Multi-threaded encoding

Since version 1.5.0, lzma-native supports liblzma’s built-in multi-threading encoding capabilities. To make use of them, set the threads option to an integer value: lzma.createCompressor({ threads: n });. You can use value of 0 to use the number of processor cores. This option is only available for the easyEncoder (the default) and streamEncoder encoders.

Note that, by default, encoding will take place in Node’s libuv thread pool regardless of this option, and setting it when multiple encoders are running is likely to affect performance negatively.

Reference

Encoding strings and Buffer objects

Creating streams for encoding

.xz file metadata

Miscellaneous functions

Encoding strings and Buffer objects

lzma.compress(), lzma.decompress()

  • lzma.compress(string, [opt, ]on_finish)
  • lzma.decompress(string, [opt, ]on_finish)
Param Type Description
string Buffer / String Any string or buffer to be (de)compressed (that can be passed to stream.end(…))
[opt] Options / int Optional. See options
on_finish Callback Will be invoked with the resulting Buffer as the first parameter when encoding is finished, and as on_finish(null, err) in case of an error.

These methods will also return a promise that you can use directly.

Example code:

lzma.compress('Bananas', 6, function(result) {
    lzma.decompress(result, function(decompressedResult) {
        assert.equal(decompressedResult.toString(), 'Bananas');
    });
});

Example code for promises:

lzma.compress('Bananas', 6).then(function(result) {
    return lzma.decompress(result);
}).then(function(decompressedResult) {
    assert.equal(decompressedResult.toString(), 'Bananas');
}).catch(function(err) {
    // ...
});

lzma.LZMA().compress(), lzma.LZMA().decompress()

  • lzma.LZMA().compress(string, mode, on_finish[, on_progress])
  • lzma.LZMA().decompress(string, on_finish[, on_progress])

(Compatibility; See LZMA-JS for the original specs.)

Note that the result of compression is in the older LZMA1 format (.lzma files). This is different from the more universally used LZMA2 format (.xz files) and you will have to take care of possible compatibility issues with systems expecting .xz files.

Param Type Description
string Buffer / String / Array Any string, buffer, or array of integers or typed integers (e.g. Uint8Array)
mode int A number between 0 and 9, indicating compression level
on_finish Callback Will be invoked with the resulting Buffer as the first parameter when encoding is finished, and as on_finish(null, err) in case of an error.
on_progress Callback Indicates progress by passing a number in [0.0, 1.0]. Currently, this package only invokes the callback with 0.0 and 1.0.

These methods will also return a promise that you can use directly.

This does not work exactly as described in the original LZMA-JS specification:

  • The results are Buffer objects, not integer arrays. This just makes a lot more sense in a Node.js environment.
  • on_progress is currently only called with 0.0 and 1.0.

Example code:

lzma.LZMA().compress('Bananas', 4, function(result) {
    lzma.LZMA().decompress(result, function(decompressedResult) {
        assert.equal(decompressedResult.toString(), 'Bananas');
    });
});

For an example using promises, see compress().

Creating streams for encoding

lzma.createCompressor(), lzma.createDecompressor()

  • lzma.createCompressor([options])
  • lzma.createDecompressor([options])
Param Type Description
[options] Options / int Optional. See options

Return a duplex stream, i.e. a both readable and writable stream. Input will be read, (de)compressed and written out. You can use this to pipe input through this stream, i.e. to mimick the xz command line util, you can write:

var compressor = lzma.createCompressor();

process.stdin.pipe(compressor).pipe(process.stdout);

The output of compression will be in LZMA2 format (.xz files), while decompression will accept either format via automatic detection.

lzma.Compressor(), lzma.Decompressor()

  • lzma.Compressor([preset], [options])
  • lzma.Decompressor([options])

(Compatibility; See node-xz for the original specs.)

These methods handle the .xz file format.

Param Type Description
[preset] int Optional. See options.preset
[options] Options Optional. See options

Return a duplex stream, i.e. a both readable and writable stream. Input will be read, (de)compressed and written out. You can use this to pipe input through this stream, i.e. to mimick the xz command line util, you can write:

var compressor = lzma.Compressor();

process.stdin.pipe(compressor).pipe(process.stdout);

lzma.createStream()

  • lzma.createStream(coder, options)
Param Type Description
[coder] string Any of the supported coder names, e.g. "easyEncoder" (default) or "autoDecoder".
[options] Options / int Optional. See options

Return a duplex stream for (de-)compression. You can use this to pipe input through this stream.

The available coders are (the most interesting ones first):

Less likely to be of interest to you, but also available:

  • aloneDecoder Decoder which only uses the legacy .lzma format. Supports the options.memlimit option.
  • rawEncoder Custom encoder corresponding to lzma_raw_encoder (See the native library docs for details). Supports the options.filters option.
  • rawDecoder Custom decoder corresponding to lzma_raw_decoder (See the native library docs for details). Supports the options.filters option.
  • streamEncoder Custom encoder corresponding to lzma_stream_encoder (See the native library docs for details). Supports options.filters and options.check options.
  • streamDecoder Custom decoder corresponding to lzma_stream_decoder (See the native library docs for details). Supports options.memlimit and options.flags options.

Options

Option name Type Description
check check Any of lzma.CHECK_CRC32, lzma.CHECK_CRC64, lzma.CHECK_NONE, lzma.CHECK_SHA256
memlimit float A memory limit for (de-)compression in bytes
preset int A number from 0 to 9, 0 being the fastest and weakest compression, 9 the slowest and highest compression level. (Please also see the xz(1) manpage for notes – don’t just blindly use 9!) You can also OR this with lzma.PRESET_EXTREME (the -e option to the xz command line utility).
flags int A bitwise or of lzma.LZMA_TELL_NO_CHECK, lzma.LZMA_TELL_UNSUPPORTED_CHECK, lzma.LZMA_TELL_ANY_CHECK, lzma.LZMA_CONCATENATED
synchronous bool If true, forces synchronous coding (i.e. no usage of threading)
bufsize int The default size for allocated buffers
threads int Set to an integer to use liblzma’s multi-threading support. 0 will choose the number of CPU cores.
blockSize int Maximum uncompressed size of a block in multi-threading mode
timeout int Timeout for a single encoding operation in multi-threading mode

options.filters can, if the coder supports it, be an array of filter objects, each with the following properties:

  • .id Any of lzma.FILTERS_MAX, lzma.FILTER_ARM, lzma.FILTER_ARMTHUMB, lzma.FILTER_IA64, lzma.FILTER_POWERPC, lzma.FILTER_SPARC, lzma.FILTER_X86 or lzma.FILTER_DELTA, lzma.FILTER_LZMA1, lzma.FILTER_LZMA2

The delta filter supports the additional option .dist for a distance between bytes (see the xz(1) manpage).

The LZMA filter supports the additional options .dict_size, .lp, .lc, pb, .mode, nice_len, .mf, .depth and .preset. See the xz(1) manpage for meaning of these parameters and additional information.

Miscellaneous functions

lzma.crc32()

  • lzma.crc32(input[, encoding[, previous]])

Compute the CRC32 checksum of a Buffer or string.

Param Type Description
input string / Buffer Any string or Buffer.
[encoding] string Optional. If input is a string, an encoding to use when converting into binary.
[previous] int The result of a previous CRC32 calculation so that you can compute the checksum per each chunk

Example usage:

lzma.crc32('Banana') // => 69690105

lzma.checkSize()

  • lzma.checkSize(check)

Return the byte size of a check sum.

Param Type Description
check check Any supported check constant.

Example usage:

lzma.checkSize(lzma.CHECK_SHA256) // => 16
lzma.checkSize(lzma.CHECK_CRC32)  // => 4

lzma.easyDecoderMemusage()

  • lzma.easyDecoderMemusage(preset)

Returns the approximate memory usage when decoding using easyDecoder for a given preset.

Param Type Description
preset preset A compression level from 0 to 9

Example usage:

lzma.easyDecoderMemusage(6) // => 8454192

lzma.easyEncoderMemusage()

  • lzma.easyEncoderMemusage(preset)

Returns the approximate memory usage when encoding using easyEncoder for a given preset.

Param Type Description
preset preset A compression level from 0 to 9

Example usage:

lzma.easyEncoderMemusage(6) // => 97620499

lzma.rawDecoderMemusage()

  • lzma.rawDecoderMemusage(filters)

Returns the approximate memory usage when decoding using rawDecoder for a given filter list.

Param Type Description
filters array An array of filters

lzma.rawEncoderMemusage()

  • lzma.rawEncoderMemusage(filters)

Returns the approximate memory usage when encoding using rawEncoder for a given filter list.

Param Type Description
filters array An array of filters

lzma.versionString()

  • lzma.versionString()

Returns the version of the underlying C library.

Example usage:

lzma.versionString() // => '5.2.3'

lzma.versionNumber()

  • lzma.versionNumber()

Returns the version of the underlying C library.

Example usage:

lzma.versionNumber() // => 50020012

.xz file metadata

lzma.isXZ()

  • lzma.isXZ(input)

Tells whether an input buffer is an XZ file (.xz, LZMA2 format) using the file format’s magic number. This is not a complete test, i.e. the data following the file header may still be invalid in some way.

Param Type Description
input string / Buffer Any string or Buffer (integer arrays accepted).

Example usage:

lzma.isXZ(fs.readFileSync('test/hamlet.txt.xz')); // => true
lzma.isXZ(fs.readFileSync('test/hamlet.txt.lzma')); // => false
lzma.isXZ('Banana'); // => false

(The magic number of XZ files is hex fd 37 7a 58 5a 00 at position 0.)

lzma.parseFileIndex()

  • lzma.parseFileIndex(options[, callback])

Read .xz file metadata.

options.fileSize needs to be an integer indicating the size of the file being inspected, e.g. obtained by fs.stat().

options.read(count, offset, cb) must be a function that reads count bytes from the underlying file, starting at position offset. If that is not possible, e.g. because the file does not have enough bytes, the file should be considered corrupt. On success, cb should be called with a Buffer containing the read data. cb can be invoked as cb(err, buffer), in which case err will be passed along to the original callback argument when set.

callback will be called with err and info as its arguments.

If no callback is provided, options.read() must work synchronously and the file info will be returned from lzma.parseFileIndex().

Example usage:

fs.readFile('test/hamlet.txt.xz', function(err, content) {
  // handle error

  lzma.parseFileIndex({
    fileSize: content.length,
    read: function(count, offset, cb) {
      cb(content.slice(offset, offset + count));
    }
  }, function(err, info) {
    // handle error
    
    // do something with e.g. info.uncompressedSize
  });
});

lzma.parseFileIndexFD()

  • lzma.parseFileIndexFD(fd, callback)

Read .xz metadata from a file descriptor.

This is like parseFileIndex(), but lets you pass an file descriptor in fd. The file will be inspected using fs.stat() and fs.read(). The file descriptor will not be opened or closed by this call.

Example usage:

fs.open('test/hamlet.txt.xz', 'r', function(err, fd) {
  // handle error

  lzma.parseFileIndexFD(fd, function(err, info) {
    // handle error
    
    // do something with e.g. info.uncompressedSize
    
    fs.close(fd, function(err) { /* handle error */ });
  });
});

Installation

This package includes the native C library, so there is no need to install it separately.

Licensing

The original C library package contains code under various licenses, with its core (liblzma) being public domain. See its contents for details. This wrapper is licensed under the MIT License.

Related projects

Other implementations of the LZMA algorithms for node.js and/or web clients include:

Note that LZMA has been designed to have much faster decompression than compression, which is something you may want to take into account when choosing an compression algorithm for large files. Almost always, LZMA achieves higher compression ratios than other algorithms, though.

Acknowledgements

Initial development of this project was financially supported by Tradity.

lzma-native's People

Contributors

ackar avatar addaleax avatar alexrsagen avatar chrmoritz avatar cscott avatar gagern avatar imrehg avatar jviotti avatar ldavidsp avatar lijy91 avatar malept avatar refack avatar simlu avatar snorp avatar tylinux avatar webcarrot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lzma-native's Issues

Problem with node 0.10 stream ending behaviour

(This issue is only for documentation, i.e. to have the bug number assigned for the regression test).

Node.js 0.10 does not reliably close file descriptors when .end() is called.
The problem will be fixed by passing Buffers internally instead of using pipes, bypassing any file descriptor problems.

lzma_native-v3.0.2-node-v59-win32-x64.tar.gz not found

Hey there,
I'm using win 10 pro 64x.
when I try run yarn upgrade, I got error :

yarn install v0.27.5
info No lockfile found.
[1/4] Resolving packages...
warning react-native > [email protected]: connect 2.x series is deprecated
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "[email protected]" has incorrect peer dependency "react@^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0".
[4/4] Building fresh packages...
[-/3] ⠁ waiting...
[2/3] ⠁ lzma-native: LINK : fatal error LNK1104: cannot open file 'F:\ReactApp\mPos\node_modules\lzma-native\deps\doc\liblzma.def' [F:\ReactApp\mPos\node_modules\lzma-native\build\liblzma.vcxpr
[-/3] ⠁ waiting...
[-/3] ⠁ waiting...
error F:\ReactApp\mPos\node_modules\lzma-native: Command failed.
Exit code: 1
Command: C:\Windows\system32\cmd.exe
Arguments: /d /s /c node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build
Directory: F:\ReactApp\mPos\node_modules\lzma-native
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | win32 | x64
node-pre-gyp info check checked for "F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node" (not found)
node-pre-gyp http GET https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.2-node-v59-win32-x64.tar.gz
node-pre-gyp http 404 https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.2-node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.2-node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.2-node-v59-win32-x64.tar.gz

F:\ReactApp\mPos\node_modules\lzma-native>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" clean ) else
(node "" clean )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info ok

F:\ReactApp\mPos\node_modules\lzma-native>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" configure --fa
llback-to-build --module=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node --module_name=lzma_native --module_path=F:\ReactApp\mPos\node_modules\lzma-native\bi
nding-v3.0.2-node-v59-win32-x64 --python=python2.7 --msvs_version=2015 ) else (node "" configure --fallback-to-build --module=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64
\lzma_native.node --module_name=lzma_native --module_path=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64 --python=python2.7 --msvs_version=2015 )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=2015',
gyp info spawn args '-I',
gyp info spawn args 'F:\ReactApp\mPos\node_modules\lzma-native\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Akbar Haryadi\.node-gyp\9.2.0\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\Akbar Haryadi\.node-gyp\9.2.0',
gyp info spawn args '-Dnode_gyp_dir=C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\Users\Akbar Haryadi\.node-gyp\9.2.0\<(target_arch)\node.lib',
gyp info spawn args '-Dmodule_root_dir=F:\ReactApp\mPos\node_modules\lzma-native',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'F:\ReactApp\mPos\node_modules\lzma-native\build',
gyp info spawn args '-Goutput_dir=.' ]
Warning: Missing input files:
F:\ReactApp\mPos\node_modules\lzma-native\build..\deps\bin_x86-64\liblzma.dll
F:\ReactApp\mPos\node_modules\lzma-native\build..\deps\doc\liblzma.def
gyp info ok

F:\ReactApp\mPos\node_modules\lzma-native>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" build --fallba
ck-to-build --module=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node --module_name=lzma_native --module_path=F:\ReactApp\mPos\node_modules\lzma-native\bindin
g-v3.0.2-node-v59-win32-x64 ) else (node "" build --fallback-to-build --module=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node --module_name=lzma_native --m
odule_path=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64 )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
build
Microsoft (R) Library Manager Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.

LINK : fatal error LNK1104: cannot open file 'F:\ReactApp\mPos\node_modules\lzma-native\deps\doc\liblzma.def' [F:\ReactApp\mPos\node_modules\lzma-native\build\liblzma.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:159:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=F:\ReactApp\mPos
\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node" "--module_name=lzma_native" "--module_path=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-
x64"
gyp ERR! cwd F:\ReactApp\mPos\node_modules\lzma-native
gyp ERR! node -v v9.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node --module_na
me=lzma_native --module_path=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (F:\ReactApp\mPos\node_modules\lzma-native\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:159:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:943:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Windows_NT 10.0.15063
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "F:\ReactApp\mPos\node_modules\lzma-native\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd F:\ReactApp\mPos\node_modules\lzma-native
node-pre-gyp ERR! node -v v9.2.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=F:\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64\lzma_native.node --module_name=lzma_native --module_path=F:
\ReactApp\mPos\node_modules\lzma-native\binding-v3.0.2-node-v59-win32-x64' (1)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I think https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.2-node-v59-win32-x64.tar.gz link si problem, because 404.

Problem when encoding large incompressible test data

(This issue is only for documentation, i.e. to have the bug number assigned for the regression test).

An LZMA_BUF_ERROR could occur under some circumstances when a large (>= 260 kB) virtually incompressible file was passed directly into an encoder stream up to 0.2.15 and 0.3.3.

Compilation fails on OS X 10.10

npm install lzma-native fails with the following error.

io.js v2.4.0
node-gyp v2.0.1

...
Making install in tests
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Nothing to be done for `install-exec-am'.
 xz-5.2.1/build-aux/install-sh -c -d '/Users/justin/<path>/node_modules/lzma-native/build/liblzma/build/share/doc/xz'
 /usr/bin/install -c -m 644 xz-5.2.1/AUTHORS xz-5.2.1/COPYING xz-5.2.1/COPYING.GPLv2 xz-5.2.1/NEWS xz-5.2.1/README xz-5.2.1/THANKS xz-5.2.1/TODO xz-5.2.1/doc/faq.txt xz-5.2.1/doc/history.txt xz-5.2.1/doc/xz-file-format.txt xz-5.2.1/doc/lzma-file-format.txt '/Users/justin/<path>/node_modules/lzma-native/build/liblzma/build/share/doc/xz'
 xz-5.2.1/build-aux/install-sh -c -d '/Users/justin/<path>/node_modules/lzma-native/build/liblzma/build/share/doc/xz/examples'
 /usr/bin/install -c -m 644 xz-5.2.1/doc/examples/00_README.txt xz-5.2.1/doc/examples/01_compress_easy.c xz-5.2.1/doc/examples/02_decompress.c xz-5.2.1/doc/examples/03_compress_custom.c xz-5.2.1/doc/examples/04_compress_easy_mt.c xz-5.2.1/doc/examples/Makefile '/Users/justin/<path>/node_modules/lzma-native/build/liblzma/build/share/doc/xz/examples'
 xz-5.2.1/build-aux/install-sh -c -d '/Users/justin/<path>/node_modules/lzma-native/build/liblzma/build/share/doc/xz/examples_old'
 /usr/bin/install -c -m 644 xz-5.2.1/doc/examples_old/xz_pipe_comp.c xz-5.2.1/doc/examples_old/xz_pipe_decomp.c '/Users/justin/<path>/node_modules/lzma-native/build/liblzma/build/share/doc/xz/examples_old'
  TOUCH Release/obj.target/liblzma.stamp
  CXX(target) Release/obj.target/lzma_native/src/util.o
  CXX(target) Release/obj.target/lzma_native/src/liblzma-functions.o
  CXX(target) Release/obj.target/lzma_native/src/filter-array.o
  CXX(target) Release/obj.target/lzma_native/src/lzma-stream.o
../src/lzma-stream.cpp:128:20: error: no member named 'move' in namespace 'std'
        self->inbufs.push(LZMA_NATIVE_MOVE(inputData));
                          ^~~~~~~~~~~~~~~~
../src/liblzma-node.hpp:39:31: note: expanded from macro 'LZMA_NATIVE_MOVE'
#define LZMA_NATIVE_MOVE std::move
                         ~~~~~^
../src/lzma-stream.cpp:209:12: error: no member named 'move' in namespace 'std'
                outbuf = LZMA_NATIVE_MOVE(outbufs.front());
                         ^~~~~~~~~~~~~~~~
../src/liblzma-node.hpp:39:31: note: expanded from macro 'LZMA_NATIVE_MOVE'
#define LZMA_NATIVE_MOVE std::move
                         ~~~~~^
../src/lzma-stream.cpp:307:13: error: no member named 'move' in namespace 'std'
                                inbuf = LZMA_NATIVE_MOVE(inbufs.front());
                                        ^~~~~~~~~~~~~~~~
../src/liblzma-node.hpp:39:31: note: expanded from macro 'LZMA_NATIVE_MOVE'
#define LZMA_NATIVE_MOVE std::move
                         ~~~~~^
../src/lzma-stream.cpp:330:13: error: no member named 'emplace' in 'std::queue<std::vector<unsigned char,
      std::allocator<unsigned char> >, std::deque<std::vector<unsigned char, std::allocator<unsigned char> >,
      std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > > >'
                                outbufs.emplace(outbuf.data(), outbuf.data() + outsz);
                                ~~~~~~~ ^
4 errors generated.
make: *** [Release/obj.target/lzma_native/src/lzma-stream.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/iojs/v2.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.1.0
gyp ERR! command "/usr/local/iojs/v2.4.0/bin/iojs" "/usr/local/iojs/v2.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/justin/<path>/node_modules/lzma-native
gyp ERR! node -v v2.4.0
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 
npm ERR! Darwin 14.1.0
npm ERR! argv "/usr/local/iojs/v2.4.0/bin/iojs" "/usr/local/bin/npm" "install" "lzma-native"
npm ERR! node v2.4.0
npm ERR! npm  v2.13.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the lzma-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls lzma-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/justin/<path>/npm-debug.log

Cannot find module 'nopt'

Hi,
It seems your latest upgrade breaks (my?) installation :

> [email protected] install XXXX/node_modules/lzma-native
> node-pre-gyp install --fallback-to-build

module.js:327
    throw err;
    ^

Error: Cannot find module 'nopt'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (XXXX/node_modules/lzma-native/node_modules/node-pre-gyp/lib/node-pre-gyp.js:14:12)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)

Maybe adding nopt as a dependency would be enough ?

Sudden LZMA_PROG_ERROR

Hi,

I'm starting to encounter the following issue in Etcher, after a lama-native version upgrade I believe:

tracker.js:10 LZMA_PROG_ERROR: Programming error
    at Error (native)
    at LZMAStream.Stream.autoDecoder (/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/index.js:295:15)
    at exports.createStream (/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/index.js:317:16)
    at Object.exports.createDecompressor (/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/index.js:330:10)
    at Object.application/x-xz (/Users/jviotti/Projects/resin/etcher/node_modules/etcher-image-stream/lib/handlers.js:103:40)
    at /Users/jviotti/Projects/resin/etcher/node_modules/etcher-image-stream/lib/index.js:71:26
    at tryCatcher (/Users/jviotti/Projects/resin/etcher/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/jviotti/Projects/resin/etcher/node_modules/bluebird/js/release/method.js:39:29)
    at Object.exports.getFromFilePath (/Users/jviotti/Projects/resin/etcher/node_modules/etcher-image-stream/lib/index.js:64:22)
    at Object.exports.getEstimatedFinalSize (/Users/jviotti/Projects/resin/etcher/node_modules/etcher-image-stream/lib/index.js:100:18)
    at electron.remote.dialog.showOpenDialog (/Users/jviotti/Projects/resin/etcher/lib/gui/os/dialog/services/dialog.js:74:21)
    at CallbacksRegistry.apply (/Users/jviotti/Projects/resin/etcher/node_modules/electron-prebuilt/dist/Electron.app/Contents/Resources/electron.asar/common/api/callbacks-registry.js:54:39)
    at EventEmitter.<anonymous> (/Users/jviotti/Projects/resin/etcher/node_modules/electron-prebuilt/dist/Electron.app/Contents/Resources/electron.asar/renderer/api/remote.js:243:21)
    at emitThree (events.js:116:13)
    at EventEmitter.emit (events.js:194:7) undefined

As far as I can see, the issue only seems to happen when running this module on Electron.

The error is thrown by lzma.createDecompressor(), which I'm simply using like this:

return Bluebird.props({
  stream: fs.createReadStream(file),
  size: fs.statAsync(file).get('size'),
  transform: Bluebird.resolve(lzma.createDecompressor())
});

If you want to reproduce this on Etcher itself, there is a small guided to run Etcher locally (see https://github.com/resin-io/etcher/blob/master/docs/CONTRIBUTING.md#running-locally). Checkout the upgrade/image-stream branch. The error is thrown as soon as you select a .xz image.

The error doesn't seem to happen on v1.4.

Cannot load on Windows

Install: npm install lzma-native
following line (in my code or in node cli) causes crash:
var lzma = require('lzma-native')
got the following output:

Error: %1 is not a valid Win32 application.
\node_modules\lzma-native\binding\lzma_native.node
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at \node_modules\lzma-native\index.js:31:14
at Object. (\node_modules\lzma-native\index.js:422:3)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)

Currently running on:
node v5.10.0
node-gyp v3.3.1
node-pre-gyp v0.6.26

OS: Win10x64

Memory leak/non-finishing streams when using asynchronous coding

This issue mostly exists for documentation purposes.
It can be reproduced for 0.2.0 in the following way:

var lzma = require('./');

var complete = 0;

for (var i = 0; i < 100; ++i) {
    console.log('+', i);
    lzma.compress('Bananas', function() {
        var c = ++complete;
        console.log('-', c);
        gc();
    });
}

At least for me, only 80 % of streams finish, the rest lingering around and, therefore, consuming memory; As a temporary measure, asynchronous coding has been disabled for the 0.2.1 release.

Doesn't build on windows.

Hello lzma native it's not building on windows 64 unsing nodejs V.5.4.1.
Here is the debugging log:

5806 silly install [email protected] C:\Users\luckcolors\Desktop\gamejolt\node_modules\.staging\lzma-native-3e2fea73d4586393475ade292442de78
5807 info lifecycle [email protected]~install: [email protected]
5808 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
5809 verbose lifecycle [email protected]~install: PATH: D:\DevTools\nvm\v5.4.1\node_modules\npm\bin\node-gyp-bin;C:\Users\luckcolors\Desktop\gamejolt\node_modules\lzma-native\node_modules\.bin;C:\Users\luckcolors\Desktop\gamejolt\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Skype\Phone\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;D:\DevTools\Git\cmd;D:\DevTools\nvm;D:\DevTools\nodejs;C:\Users\luckcolors\AppData\Roaming\npm;D:\DevTools\nvm;D:\DevTools\nodejs;D:\DevTools\wget;D:\DevTools\Git\cmd;D:\DevTools\youtube-dl;D:\DevTools\ffmpeg\bin;D:\DevTools\Sloppy;D:\DevTools\wpull
5810 verbose lifecycle [email protected]~install: CWD: C:\Users\luckcolors\Desktop\gamejolt\node_modules\lzma-native
5811 silly lifecycle [email protected]~install: Args: [ '/d /s /c', 'node-gyp rebuild' ]
5812 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
5813 info lifecycle [email protected]~install: Failed to exec install script
5814 verbose unlock done using C:\Users\luckcolors\AppData\Roaming\npm-cache\_locks\staging-0ee51277284de0f6.lock for C:\Users\luckcolors\Desktop\gamejolt\node_modules\.staging
5815 silly rollbackFailedOptional Starting
5816 silly rollbackFailedOptional Finishing
5817 silly runTopLevelLifecycles Starting
5818 silly runTopLevelLifecycles Finishing
5819 silly install printInstalled
5820 warn EPACKAGEJSON [email protected] No repository field.
5821 warn EPACKAGEJSON [email protected] No license field.
5822 verbose stack Error: [email protected] install: `node-gyp rebuild`
5822 verbose stack Exit status 1
5822 verbose stack     at EventEmitter.<anonymous> (D:\DevTools\nvm\v5.4.1\node_modules\npm\lib\utils\lifecycle.js:232:16)
5822 verbose stack     at emitTwo (events.js:87:13)
5822 verbose stack     at EventEmitter.emit (events.js:172:7)
5822 verbose stack     at ChildProcess.<anonymous> (D:\DevTools\nvm\v5.4.1\node_modules\npm\lib\utils\spawn.js:24:14)
5822 verbose stack     at emitTwo (events.js:87:13)
5822 verbose stack     at ChildProcess.emit (events.js:172:7)
5822 verbose stack     at maybeClose (internal/child_process.js:821:16)
5822 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
5823 verbose pkgid [email protected]
5824 verbose cwd C:\Users\luckcolors\Desktop\gamejolt
5825 error Windows_NT 10.0.10240
5826 error argv "D:\\DevTools\\nodejs\\node.exe" "D:\\DevTools\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
5827 error node v5.4.1
5828 error npm  v3.3.12
5829 error code ELIFECYCLE
5830 error [email protected] install: `node-gyp rebuild`
5830 error Exit status 1
5831 error Failed at the [email protected] install script 'node-gyp rebuild'.
5831 error Make sure you have the latest version of node.js and npm installed.
5831 error If you do, this is most likely a problem with the lzma-native package,
5831 error not with npm itself.
5831 error Tell the author that this fails on your system:
5831 error     node-gyp rebuild
5831 error You can get their info via:
5831 error     npm owner ls lzma-native
5831 error There is likely additional logging output above.
5832 verbose exit [ 1, true ]

npm install fails for 3.0.6

Configuration

OS: macOS 10.13.3
node: v9.9.0
npm: 5.6.0

Steps to reproduce

npm init
npm install lzma-native

> [email protected] install /Users/ftamagni/src/test-lzma/node_modules/lzma-native
> node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build

node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v59 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Hit error ENOTDIR: Cannot cd into '/Users/ftamagni/src/test-lzma/node_modules/lzma-native/binding-v3.0.6-node-v59-darwin-x64'

Then it starts to build from source, but at the end:

  COPY /Users/ftamagni/src/test-lzma/node_modules/lzma-native/binding-v3.0.6-node-v59-darwin-x64/lzma_native.node
mkdir: /Users/ftamagni/src/test-lzma/node_modules/lzma-native/binding-v3.0.6-node-v59-darwin-x64/: Not a directory
make: *** [/Users/ftamagni/src/test-lzma/node_modules/lzma-native/binding-v3.0.6-node-v59-darwin-x64/lzma_native.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2

The contents of node_modules/lzma-native directory at the beginning of installation is like:

$ ls -al node_modules/lzma-native/
total 176
drwxr-xr-x  20 ftamagni  staff    640 Mar 26 10:46 .
drwxr-xr-x   5 ftamagni  staff    160 Mar 26 10:46 ..
-rw-r--r--   1 ftamagni  staff   5642 Oct 26  1985 CHANGELOG.md
-rw-r--r--   1 ftamagni  staff   1088 Oct 26  1985 LICENSE
-rw-r--r--   1 ftamagni  staff  23728 Oct 26  1985 README.md
-rw-r--r--   1 ftamagni  staff   6652 Oct 26  1985 README.md.xz
drwxr-xr-x   3 ftamagni  staff     96 Mar 26 10:46 bin
drwxr-xr-x   3 ftamagni  staff     96 Mar 26 10:46 binding-v3.0.4-node-v61-linux-x64
-rw-r--r--   1 ftamagni  staff   6652 Mar 26 01:48 binding-v3.0.6-node-v59-darwin-x64
drwxr-xr-x   3 ftamagni  staff     96 Mar 26 10:46 binding-v3.0.6-node-v59-linux-x64
drwxr-xr-x   3 ftamagni  staff     96 Mar 26 10:46 binding-v3.0.6-node-v62-linux-x64
-rw-r--r--   1 ftamagni  staff   3203 Oct 26  1985 binding.gyp
-rwxr-xr-x   1 ftamagni  staff    253 Oct 26  1985 cflags.sh
drwxr-xr-x   9 ftamagni  staff    288 Mar 26 10:46 deps
-rw-r--r--   1 ftamagni  staff  13996 Oct 26  1985 index.js
-rwxr-xr-x   1 ftamagni  staff     52 Oct 26  1985 liblzma-build.sh
-rwxr-xr-x   1 ftamagni  staff    443 Oct 26  1985 liblzma-config.sh
drwxr-xr-x  68 ftamagni  staff   2176 Mar 26 10:46 node_modules
-rw-r--r--   1 ftamagni  staff   2352 Mar 26 10:46 package.json
drwxr-xr-x  11 ftamagni  staff    352 Mar 26 10:46 src

where binding-v3.0.6-node-v59-darwin-x64 (the interesting one) in fact is not a directory.

Note: npm install [email protected] instead works.

Error on decoding damaged archives

When I try to decompress an archive which I intentionally damaged, I get an uncaught exception. My code is something like this:

lzma.decompress(lzmaData, (result) => {
if(result===null) {
console.log('bad data');
callback(null,null);
return;
}
....
});

The callback gets never called.

Uncaught Exception Cannot read property 'code' of null
W20180221-12:05:26.186(1)? (STDERR) TypeError: Cannot read property 'code' of null
W20180221-12:05:26.187(1)? (STDERR) at JSLzmaStream._transform (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/index.js:175:25)
W20180221-12:05:26.187(1)? (STDERR) at JSLzmaStream._flush (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/index.js:196:10)
W20180221-12:05:26.187(1)? (STDERR) at JSLzmaStream. (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_transform.js:138:49)
W20180221-12:05:26.187(1)? (STDERR) at Object.onceWrapper (events.js:313:30)
W20180221-12:05:26.187(1)? (STDERR) at emitNone (events.js:106:13)
W20180221-12:05:26.187(1)? (STDERR) at JSLzmaStream.emit (events.js:208:7)
W20180221-12:05:26.187(1)? (STDERR) at prefinish (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_writable.js:596:14)
W20180221-12:05:26.187(1)? (STDERR) at finishMaybe (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_writable.js:604:5)
W20180221-12:05:26.187(1)? (STDERR) at afterWrite (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_writable.js:470:3)
W20180221-12:05:26.187(1)? (STDERR) at onwrite (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_writable.js:461:7)
W20180221-12:05:26.188(1)? (STDERR) at WritableState.onwrite (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_writable.js:169:5)
W20180221-12:05:26.188(1)? (STDERR) at afterTransform (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_transform.js:104:3)
W20180221-12:05:26.188(1)? (STDERR) at JSLzmaStream.TransformState.afterTransform (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/node_modules/readable-stream/lib/_stream_transform.js:79:12)
W20180221-12:05:26.188(1)? (STDERR) at Immediate.setImmediate (/home/vlada/Projects/trip-market-ng/tmn-client-web/node_modules/lzma-native/index.js:87:36)
W20180221-12:05:26.188(1)? (STDERR) at runCallback (timers.js:789:20)
W20180221-12:05:26.188(1)? (STDERR) at tryOnImmediate (timers.js:751:5)
W20180221-12:05:26.188(1)? (STDERR) at processImmediate [as _immediateCallback] (timers.js:722:5)
=> Exited with code: 1

Outdated dependencies

Hi. I have a question about some dependencies that this module uses. I'm using this module for one of my projects and NodeSecurity.io verified that this module has 2 outdated dependencies resulting in 2 vulnerabilities. I don't know much about this, which is why I'm just asking to make sure that it exists.

You can find these 2 vulnerabilities here:

https://nodesecurity.io/advisories/566
https://nodesecurity.io/advisories/664

My guess is that the first vulnerability can be patched by updating node-pre-gyp so that the vulnerable module ''hoek'' gets updated, resulting in patching the vulnerability. I have no idea about the second vulnerability.

issues building 32-bit version on 64 bit machine windows

I have an electron application that I've built other native modules for, I am distributing a 32-bit application, from a 64-bit installation of windows 7.

essentially, the build goes fine

npm install lzma-native --arch=ia32
electron-rebuild #with headers set to ia32

I've build like this for the node-keytar project and things went well.

the issue happens when I start up my application after I've imported the built module, i get the dreaded

%1 is not a valid Win32 application

meaning that the 64-bit version of the library was likely built and not the 32-bit.

do you have any insight into this?

Windows support ?

When i'm trying to install this package on windows i'm getting a node-gyp error when calling 'sh liblzma-config.sh ...'.

if not defined npm_config_node_gyp (node "C:\Program Files\NodeJS\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
'sh' is not recognized as an internal or external command,
operable program or batch file.
gyp: Call to 'sh liblzma-config.sh C:\Users\fatim\Desktop\BUILD\node_modules\lzma-native/build C:\Users\fatim\Desktop\BUILD\node_modules\lzma-native/deps/xz-5.2.1.tar.bz2' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\NodeJS\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\NodeJS\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\fatim\Desktop\BUILD\node_modules\lzma-native
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\NodeJS\\\\node.exe" "C:\\Program Files\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the lzma-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls lzma-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\fatim\Desktop\BUILD\npm-debug.log

Cannot find module when using electron.

Hello, I am having an issue with the module, specifically trying to require it.

The following error is produced when running the line of code const lzma = require('lzma-native')

Error: Cannot find module 'C:\Users\Asus\Desktop\LauncherElectron\node_modules\lzma-native\binding-v2.0.1-electron-v1.6-win32-x64\lzma_native.node'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (c:\Users\Asus\Desktop\LauncherElectron\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at C:\Users\Asus\Desktop\LauncherElectron\node_modules\lzma-native\index.js:12:14
at Object. (C:\Users\Asus\Desktop\LauncherElectron\node_modules\lzma-native\index.js:588:3)
at Object. (C:\Users\Asus\Desktop\LauncherElectron\node_modules\lzma-native\index.js:590:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)

Contents of the lzma-native folder below:

https://i.gyazo.com/5f99254fc0bf05f2c13764fedf01709a.png

No clue why this is happening.

Building lzma-native ia32 from x64 in GNU/Linux

I have been trying to build this project from an Ubuntu 16.04 x64 machine targeting ia32.

I first got the following error:

/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory

I installed libc6-dev-i386, and then got the following error:

/usr/include/c++/5/utility:68:28: fatal error: bits/c++config.h: No such file or directory

I then installed g++-multilib, and got the following errors:

/usr/bin/ld: i386:x86-64 architecture of input file `/home/jviotti/Projects/lzma-native/build/liblzma/build/lib/liblzma.a(liblzma_la-common.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/home/jviotti/Projects/lzma-native/build/liblzma/build/lib/liblzma.a(liblzma_la-index.o)' is incompatible with i386 output
...
/usr/bin/ld: i386:x86-64 architecture of input file `/home/jviotti/Projects/lzma-native/build/liblzma/build/lib/liblzma.a(liblzma_la-crc64_table.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/home/jviotti/Projects/lzma-native/build/liblzma/build/lib/liblzma.a(liblzma_la-simple_coder.o)' is incompatible with i386 output
collect2: error: ld returned 1 exit status
lzma_native.target.mk:128: recipe for target 'Release/obj.target/lzma_native.node' failed

I'm stuck at this point and still investigating...


Steps to reproduce:

git clone https://github.com/addaleax/lzma-native
cd lzma-native
export npm_config_arch=ia32
npm install --build-from-source

Thanks a lot!

Cannot find module 'binding-v3.0.1-node-v51-darwin-x64/lzma_native.node'

Extracting realm-sync-cocoa-2.1.10.tar.xz => /Users/duguying/code/opsapp/node_modules/realm/vendor/realm-ios
{ Error: Cannot find module '/Users/duguying/code/opsapp/node_modules/realm/node_modules/lzma-native/binding-v3.0.1-node-v51-darwin-x64/lzma_native.node'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)

Get final uncompressed size

Hi, is there a way to tell the final uncompressed size of a *.xz before attempting to do so with this module?

Trying to use this with AWS lambda

Runs locally and I'm compiling with Ubuntu 16.04 and it should work, however I'm getting an unhelpful error message that a file import fails.

Anyone else have any luck with this?

Installation fails with `sudo npm install -g`

On macOS:

$ sudo npm install -g lzma-native --verbose
Password:
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '-g',
npm verb cli   'lzma-native',
npm verb cli   '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb npm-session 5fe0ffa2a6ae399c
npm http fetch GET 200 https://registry.npmjs.org/lzma-native 40ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/nan 312ms (from cache)
npm verb correctMkdir /Users/ilg/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /Users/ilg/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
npm info lifecycle [email protected]~preuninstall: [email protected]
npm info lifecycle [email protected]~uninstall: [email protected]
npm verb unbuild rmStuff [email protected] from /usr/local/lib/node_modules
npm info lifecycle [email protected]~postuninstall: [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm info linkStuff [email protected]
npm verb linkBins [email protected]
npm verb linkBins [ { lzmajs: './bin/lzmajs' }, '/usr/local/bin', true ]
npm verb linkMans [email protected]
/usr/local/bin/lzmajs -> /usr/local/lib/node_modules/lzma-native/bin/lzmajs
npm info lifecycle [email protected]~install: [email protected]

> [email protected] install /usr/local/lib/node_modules/lzma-native
> node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/local/bin/node',
node-pre-gyp verb cli   '/usr/local/lib/node_modules/lzma-native/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/usr/local/lib/node_modules/lzma-native/binding-v3.0.7-node-v59-darwin-x64/lzma_native.node" (not found)
node-pre-gyp http GET https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v59-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v59-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp http EACCES: permission denied, mkdir '/usr/local/lib/node_modules/lzma-native/binding-v3.0.7-node-v59-darwin-x64' 
node-pre-gyp verb command build [ 'rebuild' ]
node-pre-gyp http 200 https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v59-darwin-x64.tar.gz
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'clean' ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command clean []
gyp verb clean removing "build" directory
gyp info ok 
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'configure',
gyp verb cli   '--fallback-to-build',
gyp verb cli   '--module=/usr/local/lib/node_modules/lzma-native/binding-v3.0.7-node-v59-darwin-x64/lzma_native.node',
gyp verb cli   '--module_name=lzma_native',
gyp verb cli   '--module_path=/usr/local/lib/node_modules/lzma-native/binding-v3.0.7-node-v59-darwin-x64' ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:170:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)\n    at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)\n    at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)\n    at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16\n    at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5\n    at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:170:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import platform; print(platform.python_version());"` returned: "2.7.10\n"
gyp verb get node dir no --target version specified, falling back to host node version: 9.10.1
gyp verb command install [ '9.10.1' ]
gyp verb install input version string "9.10.1"
gyp verb install installing version: 9.10.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 9.10.1
gyp verb ensuring nodedir is created /Users/ilg/.node-gyp/9.10.1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/ilg/.node-gyp/9.10.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/lzma-native/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '9.10.1' ]
gyp verb install input version string "9.10.1"
gyp verb install installing version: 9.10.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 9.10.1
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/lzma-native/.node-gyp/9.10.1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/lzma-native/.node-gyp/9.10.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/lzma-native/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
...
gyp verb command install [ '9.10.1' ]
gyp verb install input version string "9.10.1"
gyp verb install installing version: 9.10.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 9.10.1
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/lzma-native/.node-gyp/9.10.1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/lzma-native/.node-gyp/9.10.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/lzma-native/.node-gyp"
gyp verb ^Ctmpdir == cwd automatically will remove dev files after to save disk space
npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle false
npm verb lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/lzma-native/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
npm verb lifecycle [email protected]~install: CWD: /usr/local/lib/node_modules/lzma-native

The problem is not related only to Python, I tried both on Ubuntu and ARCH:

lzma-native-arch.txt

weird hanging

node.js: v4.1.1
lzma-native: 0.3.9
i try:
var fs = require('fs');
var lzma = require('lzma-native');
var r = fs.createReadStream('test.jpg');
var compressor = lzma.createCompressor();
var decompressor = lzma.createDecompressor();
var w = fs.createWriteStream('test2.jpg');
r.pipe(compressor).pipe(decompressor).pipe(w);

test2.jpg is generated correctly, but execution wont stop.

lzma-native does not download liblzma.dll on Windows

When running npm install --save lzma-native on Windows 10, and then trying to require it, when it requires the .node binding it throws the following error:

module.js:678
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified module could not be found.
\\?\C:\Users\[Folder]\node_modules\lzma-native\binding\lzma_native.node
    at Object.Module._extensions..node (module.js:678:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
    at C:\Users\[Folder]\node_modules\lzma-native\index.js:14:14
    at Object.<anonymous> (C:\Users\[folder]\node_modules\lzma-native\index.js:626:3)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)

Looking at the binding/ directory, only lzma_native.node appears. The work around (for me) was to install v3.0.8 (which then grabbed the .dll file, then copy that in to the bindings/ directory for the lzma-native version I want to use

Issue building for electron on windows

I can't seem to get this module to build on windows. I'm being told 'lib.exe' is not found.

An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  build
  'lib.exe' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native\build\liblzma.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.7.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=lzma_native" "--module_path=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\binding-v3.0.4-electron-v1.7-win32-x64" "--host=https://node-pre-gyp.addaleax.net" "--remote_path=./lzma-native/"
gyp ERR! cwd C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native
gyp ERR! node -v v8.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Failed with exit code: 1

Error: gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Nathan\\.electron-gyp\\.node-gyp\\iojs-1.7.10\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  build
  'lib.exe' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native\build\liblzma.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=1.7.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=lzma_native" "--module_path=C:\\Users\\Nathan\\Documents\\GitHub\\bsptool\\node_modules\\lzma-native\\binding-v3.0.4-electron-v1.7-win32-x64" "--host=https://node-pre-gyp.addaleax.net" "--remote_path=./lzma-native/"
gyp ERR! cwd C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\lzma-native
gyp ERR! node -v v8.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\spawn-rx\lib\src\index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:239:16)
    at SafeSubscriber.error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:198:26)
    at Subscriber._error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:129:26)
    at Subscriber.error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:103:18)
    at MapSubscriber.Subscriber._error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:129:26)
    at MapSubscriber.Subscriber.error (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:103:18)
    at SafeSubscriber._next (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\spawn-rx\lib\src\index.js:251:65)
    at SafeSubscriber.__tryOrUnsub (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:239:16)
    at SafeSubscriber.next (C:\Users\Nathan\Documents\GitHub\bsptool\node_modules\rxjs\Subscriber.js:186:22)

node-pre-gyp fails on npm install -g

I've got this problem where npm install -g of my app fails with this error and I have no idea why? I tried to google the problem and found no working solution.
I also have node-gyp install in global mode.

> [email protected] install /home/.nvm/versions/node/v7.9.0/lib/node_modules/xx/node_modules/lzma-native
> node-pre-gyp install --fallback-to-build

sh: node-pre-gyp: command not found
/home/.nvm/versions/node/v7.9.0/lib
└── (empty)

npm ERR! Linux 3.14.32-xxxx-grs-ipv6-64
npm ERR! argv "/home/.nvm/versions/node/v7.9.0/bin/node" "/home/.nvm/versions/node/v7.9.0/bin/npm" "install" "-g"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lzma-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs lzma-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls lzma-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
 node-pre-gyp -v; node -v
v0.6.36
v7.9.0

Multi-threaded compression

XZ utils allow multithreaded compression through -T [0..N] switch (being 0 the value to create as many threads as CPU cores), which makes a huge difference in compression time on multicore systems.

Does this library allow something similar?

Thank you.

runtime error against different targets of electron

I have an electron application that's been a longtime user of your software, I've been updating electron periodically, each time updating as we figured out together in this issue: #22

Today I updated electron from 1.6.10 -> 2.0.2.

I don't think this is an electron issue because if I clear out all my node_modules dirs and install electron 1.6.10 using the technique below, lzma-native loads perfectly fine. But against electron 2.0.2, it appears to build but throws that error in the console whenever loaded.

The node-pre-gyp process finishes correctly, but I get an error when starting the application:

Uncaught Error: The system cannot find message text for message number 0x%1 in the message file for %2.
\\?\C:\Users\test\electron-lobby\build\node_modules\lzma-native\binding-v2.0.1-electron-v2.0-win32-ia32\lzma_native.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (module.js:586:17)
    at require (internal/module.js:11:18)
    at C:\Users\test\electron-lobby\build\node_modules\lzma-native\index.js:12:14
    at Object.<anonymous> (C:\Users\test\electron-lobby\build\node_modules\lzma-native\index.js:588:3)

I updated in the recommended way (for npm):

npm install [email protected] --arch=ia32
<<then in the application dir>>
export npm_config_target=2.0.2
export npm_config_arch=ia32
export npm_config_disturl=https://atom.io/download/electron
export npm_config_runtime=electron
export npm_config_build_from_source=true
npm install lzma-native

an additional complication is that I target ia32 but the machine is x64, the directories output in binding seem to confirm it's able to build ia32 correctly though.

fallback to local build fails

attempting to install module via [email protected] / [email protected] fails with the following:

5854 verbose stack Error: [email protected] install: `node-pre-gyp install --fallback-to-build`
5854 verbose stack Exit status 1
5854 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:232:16)
5854 verbose stack     at emitTwo (events.js:106:13)
5854 verbose stack     at EventEmitter.emit (events.js:191:7)
5854 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14)
5854 verbose stack     at emitTwo (events.js:106:13)
5854 verbose stack     at ChildProcess.emit (events.js:191:7)
5854 verbose stack     at maybeClose (internal/child_process.js:852:16)
5854 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
5855 verbose pkgid [email protected]
5856 verbose cwd /mnt/rw-a
5857 error Linux 4.9.0-rc6-yocto-standard
5858 error argv "/usr/bin/node" "/usr/bin/npm" "i" "--save" "--verbose" "lzma-native@*"
5859 error node v6.3.1
5860 error npm  v3.5.1
5861 error code ELIFECYCLE
5862 error [email protected] install: `node-pre-gyp install --fallback-to-build`
5862 error Exit status 1

npm-debug.log.txt

the host platform is a linux yocto build on kernel 4.9 with build dependencies installed (i am able to install a number of other native modules requiring node-gyp/etc which install/update without issue)

any assistance appreciated!

Uncaught TypeError: Cannot create property 'checks' on boolean 'false'

Hi,

I'm also encountering this error when starting to make use of lzma.parseFileIndexFD().

This is the code using it:

return fs.openAsync(file, 'r').then((fileDescriptor) => {
  return lzma.parseFileIndexFDAsync(fileDescriptor).tap(() => {
    return fs.closeAsync(fileDescriptor);
  });
});

Which results in:

screenshot 2016-07-19 09 24 50

What's also weird is that this only happens on Electron, so maybe its related to: #25

node v10 pre-built native binding

Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp info check checked for "/opt/project-glacier/node_modules/lzma-native/binding-v3.0.7-node-v64-linux-x64/lzma_native.node" (not found)
node-pre-gyp http GET https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v64-linux-x64.tar.gz
node-pre-gyp http 404 https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://node-pre-gyp.addaleax.net/lzma-native/lzma_native-v3.0.7-node-v64-linux-x64.tar.gz
gyp info it worked if it ends with ok

Can't npm install

Now using node v7.2.1 (npm v3.10.10)

npm i --save --verbose lzma-native@*

It get's stuck here

loadRequestedDeps: http fetch 200 https://registry.npmjs.org/lzma-native/-/lzma-native-1.5.1.tgz

npm info it worked if it ends with ok
npm verb cli [ '/home/bob/.nvm/versions/node/v7.2.1/bin/node',
npm verb cli   '/home/bob/.nvm/versions/node/v7.2.1/bin/npm',
npm verb cli   'i',
npm verb cli   '--save',
npm verb cli   '--verbose',
npm verb cli   'lzma-native@*' ]
npm info using [email protected]
npm info using [email protected]
npm verb request uri https://registry.npmjs.org/lzma-native
npm verb request no auth needed
npm info attempt registry request try #1 at 3:21:03 PM
npm verb request id bdbc004761c1a22c
npm verb etag W/"57c02265-1c852"
npm verb lastModified Fri, 26 Aug 2016 11:05:09 GMT
npm http request GET https://registry.npmjs.org/lzma-native
npm http 304 https://registry.npmjs.org/lzma-native
npm verb headers { date: 'Thu, 15 Dec 2016 09:51:12 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: 'W/"57c02265-1c852"',
npm verb headers   age: '41',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-sin6921-SIN',
npm verb headers   'x-cache': 'HIT',
npm verb headers   'x-cache-hits': '2',
npm verb headers   'x-timer': 'S1481795472.969594,VS0,VE0',
npm verb headers   vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/lzma-native from cache
npm verb get saving lzma-native to /home/bob/.npm/registry.npmjs.org/lzma-native/.cache.json
npm verb correctMkdir /home/bob/.npm correctMkdir not in flight; initializing
npm verb cache add spec lzma-native@*
npm verb addNamed "*" is a valid semver range for lzma-native
npm verb addNameRange registry:https://registry.npmjs.org/lzma-native not in flight; fetching
npm verb get https://registry.npmjs.org/lzma-native not expired, no request
npm verb addNamed "1.5.2" is a plain semver version for lzma-native
npm verb addRemoteTarball https://registry.npmjs.org/lzma-native/-/lzma-native-1.5.2.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/lzma-native/-/lzma-native-1.5.2.tgz',
npm verb addRemoteTarball   'db656ac133608155bd0e6eb2a96ab1af0dd33d24' ]
npm info retry fetch attempt 1 at 3:21:13 PM
npm info attempt registry request try #1 at 3:21:13 PM
npm http fetch GET https://registry.npmjs.org/lzma-native/-/lzma-native-1.5.2.tgz
npm http fetch 200 https://registry.npmjs.org/lzma-native/-/lzma-native-1.5.2.tgz

Cannot find module 'binding-v3.0.4-node-v51-darwin-x64/lzma_native.node'

Hey guy, I'm getting stuck with this issue:

v7.10.0 is already installed.
Now using node v7.10.0 (npm v4.2.0)
Resolved requirements: { SYNC_SERVER_FOLDER: 'sync',
SYNC_ARCHIVE: 'realm-sync-cocoa-2.1.10.tar.xz',
SYNC_ARCHIVE_ROOT: 'core' }
No lockfile found at the target, proceeding.
Extracting realm-sync-cocoa-2.1.10.tar.xz => /Volumes/Data/WORKS/ReactNative/CreditCardMobileApp/node_modules/realm/vendor/realm-ios
{ Error: Cannot find module '/Volumes/Data/WORKS/ReactNative/CreditCardMobileApp/node_modules/lzma-native/binding-v3.0.4-node-v51-darwin-x64/lzma_native.node'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at /Volumes/Data/WORKS/ReactNative/CreditCardMobileApp/node_modules/lzma-native/index.js:13:14
at Object. (/Volumes/Data/WORKS/ReactNative/CreditCardMobileApp/node_modules/lzma-native/index.js:595:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12) code: 'MODULE_NOT_FOUND' }
Command /bin/sh failed with exit code 1

I installed lzma-native in my RA project, and this list files in lzma were installed:

drwxr-xr-x 20 kent2508 admin 680 Dec 20 14:10 .
drwxr-xr-x 719 kent2508 admin 24446 Dec 20 14:10 ..
-rw-r--r-- 1 kent2508 admin 5032 Nov 27 20:05 CHANGELOG.md
-rw-r--r-- 1 kent2508 admin 1088 Sep 22 17:41 LICENSE
-rw-r--r-- 1 kent2508 admin 23728 Sep 22 17:41 README.md
-rw-r--r-- 1 kent2508 admin 6652 Nov 26 20:05 README.md.xz
drwxr-xr-x 3 kent2508 admin 102 Dec 20 14:10 bin
drwxr-xr-x 3 kent2508 admin 102 Dec 20 14:10 binding-v3.0.1-node-v58-linux-x64
drwxr-xr-x 3 kent2508 admin 102 Dec 20 14:10 binding-v3.0.1-node-v59-linux-x64
drwxr-xr-x 3 kent2508 admin 102 Dec 20 14:10 binding-v3.0.3-node-v59-linux-x64
drwxr-xr-x 3 kent2508 admin 102 Dec 20 14:10 binding-v3.0.4-node-v57-darwin-x64
-rw-r--r-- 1 kent2508 admin 3203 Sep 22 17:41 binding.gyp
-rwxr-xr-x 1 kent2508 admin 253 Sep 22 17:41 cflags.sh
drwxr-xr-x 9 kent2508 admin 306 Dec 20 14:10 deps
-rw-r--r-- 1 kent2508 admin 13877 Nov 27 20:05 index.js
-rwxr-xr-x 1 kent2508 admin 52 Sep 22 17:41 liblzma-build.sh
-rwxr-xr-x 1 kent2508 admin 443 Sep 22 17:41 liblzma-config.sh
drwxr-xr-x 111 kent2508 admin 3774 Dec 20 14:10 node_modules
-rw-r--r-- 1 kent2508 admin 2408 Dec 20 14:10 package.json
drwxr-xr-x 11 kent2508 admin 374 Dec 20 14:10 src

node-pre-gyp.entless.org has an invalid certificate

This code: https://github.com/addaleax/lzma-native/blob/master/package.json#L55-L60
tells node-gyp to download pre-built binaries from https://node-pre-gyp.entless.org, but it seems like that host has a certificate that is expired, or is otherwise invalid.

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp info check checked for "***/node_modules/lzma-native/binding-v3.0.1-node-v57-darwin-x64/lzma_native.node" (not found)
node-pre-gyp http GET https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.1-node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.1-node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http certificate has expired
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (***/node_modules/node-pre-gyp/lib/util/compile.js:77:29)
node-pre-gyp ERR! stack     at emitOne (events.js:115:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:7)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
node-pre-gyp ERR! stack     at onErrorNT (internal/child_process.js:374:16)
node-pre-gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
node-pre-gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:180:9)
node-pre-gyp ERR! System Darwin 16.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/8.6.0/bin/node" "***/node_modules/lzma-native/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"

screen shot 2017-11-07 at 5 06 59 pm

invalid/unnecessary rimraf path in install script

Probably:
https://github.com/addaleax/lzma-native/blob/master/package.json#L36

    "install": "node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build",

should be change to:

    "install": "node-pre-gyp install --fallback-to-build && rimraf build",

after remove:

  "bundledDependencies": [
    "node-pre-gyp", "rimraf"
  ],

in v4.0.0 .

Otherwise package fail to install.

> [email protected] install /path/node_modules/lzma-native
> node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
[lzma-native] Success: "/path/node_modules/lzma-native/binding-v4.0.0-node-v64-linux-x64/lzma_native.node" is installed via remote
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '/path/node_modules/lzma-native/node_modules/rimraf/bin.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/wojtek/.npm/_logs/2018-07-26T13_06_17_841Z-debug.log

missing install dependency rimraf

looks like there's a dependency on rimraf for this module which, for some reason in my case, isn't being installed as part of the build - any idea why or how we can get this fixed?

  SOLINK_MODULE(target) Release/obj.target/lzma_native.node
  COPY Release/lzma_native.node
  COPY /mnt/rw-a/node_modules/lzma-native/binding-v3.0.1-node-v51-linux-arm/lzma_native.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/mnt/rw-a/node_modules/lzma-native/build'
module.js:472
    throw err;
    ^

Error: Cannot find module '/mnt/rw-a/node_modules/lzma-native/node_modules/rimraf/bin.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

npm ERR! Linux 4.9.4-yocto-standard
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build`
npm ERR! Exit status 1

using npm install lzma-native on a yocto embedded linux build, and installing rimraf by itself succeeds.

Sudden Windows build failures

lzma-native is suddenly failing to build in all Etcher pull requests on Windows for no apparent reason. See the following build logs for an example: https://ci.appveyor.com/project/resin-io/etcher/build/job/2cfvk4dpnder5c62

These are the errors we're seeing:

[00:04:07] > [email protected] install C:\projects\etcher\node_modules\lzma-native
[00:04:07] > node-pre-gyp install --fallback-to-build
[00:04:07] 
[00:04:13] Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
[00:04:15]   build
[00:04:15]   The input line is too long.
[00:04:15] C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\projects\etcher\node_modules\lzma-native\build\liblzma.vcxproj]
[00:04:15] gyp ERR! build error 
[00:04:15] gyp ERR! stack Error: `msbuild` failed with exit code: 1
[00:04:15] gyp ERR! stack     at ChildProcess.onExit (C:\projects\etcher\node_modules\node-gyp\lib\build.js:285:23)
[00:04:15] gyp ERR! stack     at emitTwo (events.js:106:13)
[00:04:15] gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
[00:04:15] gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
[00:04:15] gyp ERR! System Windows_NT 6.3.9600
[00:04:15] gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "C:\\projects\\etcher\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\projects\\etcher\\node_modules\\lzma-native\\binding\\lzma_native.node" "--module_name=lzma_native" "--module_path=C:\\projects\\etcher\\node_modules\\lzma-native\\binding"
[00:04:15] gyp ERR! cwd C:\projects\etcher\node_modules\lzma-native
[00:04:15] gyp ERR! node -v v6.1.0
[00:04:15] gyp ERR! node-gyp -v v3.6.0
[00:04:15] gyp ERR! not ok 
[00:04:15] node-pre-gyp ERR! build error 
[00:04:15] node-pre-gyp ERR! stack Error: Failed to execute 'c:\Program Files\nodejs\node.exe C:\projects\etcher\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\etcher\node_modules\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\projects\etcher\node_modules\lzma-native\binding' (1)
[00:04:15] node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\projects\etcher\node_modules\lzma-native\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
[00:04:15] node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
[00:04:15] node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
[00:04:15] node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:850:16)
[00:04:15] node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
[00:04:15] node-pre-gyp ERR! System Windows_NT 6.3.9600
[00:04:15] node-pre-gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "C:\\projects\\etcher\\node_modules\\lzma-native\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
[00:04:15] node-pre-gyp ERR! cwd C:\projects\etcher\node_modules\lzma-native
[00:04:15] node-pre-gyp ERR! node -v v6.1.0
[00:04:15] node-pre-gyp ERR! node-pre-gyp -v v0.6.29
[00:04:15] node-pre-gyp ERR! not ok 
[00:04:15] Failed to execute 'c:\Program Files\nodejs\node.exe C:\projects\etcher\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\etcher\node_modules\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\projects\etcher\node_modules\lzma-native\binding' (1)

The above errors during npm install finally result in:

[00:04:18] npm ERR! Windows_NT 6.3.9600
[00:04:18] npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
[00:04:18] npm ERR! node v6.1.0
[00:04:18] npm ERR! npm  v3.8.6
[00:04:18] npm ERR! code ELIFECYCLE
[00:04:18] 
[00:04:18] npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
[00:04:18] npm ERR! Exit status 1
[00:04:18] npm ERR! 
[00:04:18] npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
[00:04:18] npm ERR! Make sure you have the latest version of node.js and npm installed.
[00:04:18] npm ERR! If you do, this is most likely a problem with the lzma-native package,
[00:04:18] npm ERR! not with npm itself.
[00:04:18] npm ERR! Tell the author that this fails on your system:
[00:04:18] npm ERR!     node-pre-gyp install --fallback-to-build
[00:04:18] npm ERR! You can get information on how to open an issue for this project with:
[00:04:18] npm ERR!     npm bugs lzma-native
[00:04:18] npm ERR! Or if that isn't available, you can get their info via:
[00:04:18] npm ERR!     npm owner ls lzma-native
[00:04:18] npm ERR! There is likely additional logging output above.
[00:04:18] 
[00:04:18] npm ERR! Please include the following file with any support request:
[00:04:18] npm ERR!     C:\projects\etcher\npm-debug.log

We're shrinkwrapping our dependencies, so we're guessing the problem is caused by either a development dependency or node/npm.

I cloned this repo and checked out the 1.5.2 tag (which is the one we're using) on a Windows 10 machine running npm 3.10.10 on node v6.9.4 and got the following errors when doing npm install ---build-from-source:

C:\Projects\lzma-native>npm install --build-from-source

> [email protected] install C:\Projects\lzma-native
> node-pre-gyp install --fallback-to-build


C:\Projects\lzma-native>if not defined npm_config_node_gyp (node "C:\Users\jviotti\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (node "" clean )

C:\Projects\lzma-native>if not defined npm_config_node_gyp (node "C:\Users\jviotti\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=C:\Projects\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\Projects\lzma-native\binding )  else (node "" configure --fallback-to-build --module=C:\Projects\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\Projects\lzma-native\binding )
Warning: Missing input files:
C:\Projects\lzma-native\build\..\deps\doc\liblzma.def

C:\Projects\lzma-native>if not defined npm_config_node_gyp (node "C:\Users\jviotti\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" build --fallback-to-build --module=C:\Projects\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\Projects\lzma-native\binding )  else (node "" build --fallback-to-build --module=C:\Projects\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\Projects\lzma-native\binding )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  build
  Microsoft (R) Library Manager Version 14.00.24215.1
  Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1104: cannot open file 'C:\Projects\lzma-native\deps\doc\liblzma.def' [C:
\Projects\lzma-native\build\liblzma.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\jviotti\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jviotti\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Projects\\lzma-native\\binding\\lzma_native.node" "--module_name=lzma_native" "--module_path=C:\\Projects\\lzma-native\\binding"
gyp ERR! cwd C:\Projects\lzma-native
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Projects\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\Projects\lzma-native\binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Projects\lzma-native\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.14393
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Projects\\lzma-native\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Projects\lzma-native
node-pre-gyp ERR! node -v v6.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.33
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Projects\lzma-native\binding\lzma_native.node --module_name=lzma_native --module_path=C:\Projects\lzma-native\binding' (1)npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lzma-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs lzma-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls lzma-native
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jviotti\AppData\Roaming\npm-cache\_logs\2017-03-16T16_39_42_730Z-debug.log

To summarize, the above output prints the following error:

LINK : fatal error LNK1104: cannot open file 'C:\Projects\lzma-native\deps\doc\liblzma.def' [C:
\Projects\lzma-native\build\liblzma.vcxproj]

And the referenced file does not exist:

C:\Projects\lzma-native\deps>dir
 Volume in drive C has no label.
 Volume Serial Number is 9890-734C

 Directory of C:\Projects\lzma-native\deps

03/16/17  12:31 PM    <DIR>          .
03/16/17  12:31 PM    <DIR>          ..
03/16/17  12:31 PM                36 .gitignore
03/16/17  12:31 PM                 0 .npmignore
03/16/17  12:31 PM           647,563 xz-5.2.1-windows.7z
03/16/17  12:31 PM               543 xz-5.2.1-windows.7z.sig
03/16/17  12:31 PM         1,186,051 xz-5.2.1.tar.bz2
03/16/17  12:31 PM               543 xz-5.2.1.tar.bz2.sig
               6 File(s)      1,834,736 bytes
               2 Dir(s)  98,177,015,808 bytes free

Do you have any clues about what might be going wrong?

node-pre-gyp.entless.org has an expired certificate

Seeing the same thing as #46.

21:36:45 node-pre-gyp http GET https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.1-node-v57-darwin-x64.tar.gz
21:36:45 node-pre-gyp ERR! Tried to download(undefined): https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.1-node-v57-darwin-x64.tar.gz 
21:36:45 node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp) 
21:36:45 node-pre-gyp http certificate has expired 
21:36:45 node-pre-gyp ERR! build error 
21:36:45 node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
21:36:45 node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/jenkins/workspace/Mobile/interstellar-ios-develop/node_modules/node-pre-gyp/lib/util/compile.js:77:29)
21:36:45 node-pre-gyp ERR! stack     at emitOne (events.js:116:13)
21:36:45 node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:211:7)
21:36:45 node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
21:36:45 node-pre-gyp ERR! stack     at onErrorNT (internal/child_process.js:372:16)
21:36:45 node-pre-gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
21:36:45 node-pre-gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:180:9)
21:36:45 node-pre-gyp ERR! System Darwin 17.4.0

Hitting https://node-pre-gyp.entless.org/lzma-native/lzma_native-v3.0.1-node-v57-darwin-x64.tar.gz in a browser also gives an invalid cert error.

Error: Cannot find module 'binding-v3.0.1-node-v57-darwin-x64'

Error occors when integrate realm to a react native app with version 2.0.2.
And there is no folder named 'binding-v3.0.1-node-v57-darwin-x64' existed in folder 'lzma-native'.

{ Error: Cannot find module '/Users/username/ReactNative/folder/Native/node_modules/lzma-native/binding-v3.0.1-node-v57-darwin-x64/lzma_native.node'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at /Users/username/ReactNative/folder/Native/node_modules/lzma-native/index.js:13:14
at Object. (/Users/username/ReactNative/folder/Native/node_modules/lzma-native/index.js:595:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12) code: 'MODULE_NOT_FOUND' }

Worker Threads: "Module did not self-register"

When using the new experimental worker threads in Node 10.5 and above, if you require lzma-native in both the parent and the worker, the following error is thrown:

Error: Module did not self-register.
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /Users/matt.olson/workspace/storefront-renderer/node_modules/lzma-native/index.js:13:14
    at Object.<anonymous> (/Users/matt.olson/workspace/storefront-renderer/node_modules/lzma-native/index.js:597:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

This seems to be related to nodejs/node#21783 and nodejs/node#21481. I believe the issue is that the module needs to be context-aware.

I ran into a similar issue with the lzo package and have a PR open for it. We will need to do something similar here.

Decompressor stream hangs

The decompressor hangs on my files, compressed with xz from liblzma 5.1.0alpha (on Ubuntu Trusty). For my files it looks like it pretty consistently happens around > 650MB.

Here is a test file.

My test script (ES6):

'use strict';

import lzma from 'lzma-native';
import fs from 'fs';
import split from 'split';
import stream from 'stream';

let byteCount = 0;

class TestWriter extends stream.Writable {
  constructor() {
    super({objectMode: true});
    this.count = 0;
  }

  _write(obj, encoding, callback) {
    if ((this.count++ % 10000) === 0) {
      console.log(`${this.count} lines, ${byteCount} bytes`);
    }
    callback();
  }
}

let file = fs.createReadStream('test.xz');
let decompressor = lzma.createDecompressor();
let decompress = file.pipe(decompressor);
let lines = decompress.pipe(split(/\r?\n/));
lines.on('data', line => {
  byteCount += line.length;
});

let writer = new TestWriter();
writer.on('finish', () => {
  console.log("Finish");
  process.exit(0);
});
lines.pipe(writer);

npm install from package.json not working on all systems

I have lzma-native in my package.json file on my node app:
"lzma-native": "~1.3.1"

It loads fine when I push my repo to heroku. However, if I clone the repository locally (on mac) and npm install, it does not install the binding folder and perhaps other elements, which forces my app to error.

I'm not a total node expert, so perhaps this is my mistake?..please advise. Thanks!

Invalid HTTPS cert on entless.org preventing node-pre-gyp precompiled binary fetches

Yo, it's that time of the year when we bug you again :)

According to the log lines in our CI, downloading the precompiled binary with node-pre-gyp fails:

node-pre-gyp ERR! Tried to download: https://node-pre-gyp.entless.org/lzma-native/lzma_native-v1.5.2-node-v48-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp) 

Visiting the url manually shows the following cert error: NET::ERR_CERT_COMMON_NAME_INVALID
Thanks a ton for the awesome library, we've been happily using it for around a year :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.