2

I didn't read enough the manual and run the following command

$ zstd -r folder -o output.zst

The following command gave me back a single file called output

$ unzstd output.zst 

The output file has all the contents of the files under the folder concatenated.

Is there some tools or programs to un-concatenate the single file into multiple original files?

This is the only backup file I have and I need the backup.

EDIT: what I really should have run (according to this thread) is

# for tar version 1.31 and above
$ tar --zstd -cf output.tar.zst folder

# for tar version < 1.31
$ tar --use-compress-program zstd -cf output.tar.zst folder

1 Answer 1

2

I also posted this question in zstd github issue and I learnt the following from Cyan4973.

all compressed frames are just stored back to back in the same file output.zst.

While there would be a way, at least in theory, to separate each frame, and therefore find the boundaries of each file, another problem is that none of these frames contain the file name, nor the position in directory tree. So you would end up with a bunch of nameless files.

The proper way to archive is to combine zstd with tar, which is in charge of preserving file metadata.

Currently there is no tools or programs to separate frames. But someone could write using lz4frame.h.

By default, the CLI will just decompress all frames back-to-back into the same decompressed file ...

... program it yourself, ... use the ZSTD_decompressStream() API.

1
  • 2
    Since it's about zstd frames, the proper API is ZSTD_decompressStream(), published in zstd.h .
    – Cyan
    Nov 2, 2019 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.