Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompress archives from xz file #139

Open
davidmrindus opened this issue May 9, 2023 · 0 comments
Open

Decompress archives from xz file #139

davidmrindus opened this issue May 9, 2023 · 0 comments

Comments

@davidmrindus
Copy link

davidmrindus commented May 9, 2023

Hello,
Is it possible to decompress individual files (JSON files) from one .xz archive? I achieved to get a content of all files by using streams to one file.

...
return new Promise(async (resolve, reject) => {
 const input = fs.createReadStream(src);
 const output = fs.createWriteStream('/file.json');

 input.pipe(decompressor).pipe(output)
 output.on('finish', () => {
  resolve()
 })
})
...

Calling lzma.parseFileIndexFD of xz file, I got:

{
  streamPadding: 0,
  memlimit: null,
  streams: 1,
  blocks: 1,
  fileSize: 260964,
  uncompressedSize: 4114432,
  checks: [ 4 ]
}

Is there any option to tell lzma to decompress all files inside xz file? Something similar as python's library tarfile method TarFile.extractall: https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant