question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The compressed file cannot be decompressed by lzma command on Mac OS

See original GitHub issue

I’m using LZMA-JS on nodejs, my code is as below

var my_lzma = require("lzma");
var fs = require('fs');

var result = my_lzma.compress('123456789qwertyuiop');
fs.writeFileSync('b.txt', new Buffer(result, 'ascii'), null, 'b');

then, I renamed “b.txt” to “b.txt.lzma” and tried to use lzma command to decompress it. but I only get the error message

lzma: b2.txt.lzma: Compressed data is corrupt

LZMA-JS and lzma command both are based on the same algorithm, from my understanding, lzma can decompress the file that is compressed by LZMA-JS, am I right? So could you please help me to find out the problem that why the file get decompressed failed? Thanks

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
jeanbmarcommented, Mar 17, 2020

I’m late to the party but you can do this:

const lzmajs = require('lzma');
lzmajs.LZMA().disableEndMark = true;
// ... do your stuff
1reaction
addaleaxcommented, Apr 20, 2016

I’d prefer not to do anything without @nmrugg’s input but I think LZMA-JS is wrongly writing the end-of-payload marker to the compressed stream even though the compressed size is known. That should not be allowed according to the docs (ref), and commenting out the call to $WriteEndMarker seems to solve this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compress and uncompress file archives in Terminal on Mac
In Terminal, you can use the GNU tar command to compress and uncompress files and folders. The usual file extension for a compressed...
Read more >
The compressed file cannot be decompressed by lzma command on ...
I'm using LZMA-JS on nodejs, my code is as below var my_lzma = require("lzma"); var fs = require('fs'); var result = my_lzma.compress('123456789qwertyuiop') ...
Read more >
macos - Does OSX 10.10.4 support LZMA compression at the ...
From the command line, I would like to compress some database dumps using the LZMA algorithm. And, OSX adds XZ support (written in...
Read more >
lzma(1) [osx man page] - The UNIX and Linux Forums
xz, unxz, xzcat, lzma, unlzma, lzcat - Compress or decompress .xz and .lzma files SYNOPSIS xz [option...] [file...] COMMAND ALIASES
Read more >
Compress and decompress files using AppleArchive
Support in Apple's bundled Archive Utility is incomplete. That app happily decompresses LZFSE .aar archives, and I suspect the version shipped ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found