Skip to content

Decompress archives from xz file #139

Description

@davidmrindus

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions