A native Go CLI tool for extracting files from an interlaced tar file (regular or STDIN).
The TAR file format allows for entries with duplicate file names. Most implementations will either complain during extraction or overwrite earlier extracted versions with latter versions.
I think allowing duplicate named entries makes tar feel more like a chunked file or stream multiplexor. In thinking about tar streams this way you can use allingeek/tar-merge-stream as a tar mux and this project as a tar demux.
- tar-demux appends file chunks in the order they are encountered in the archive.
- tar-demux will append contents of the archive to existing files on disk.
- tar-demux writes nothing to STDOUT (terminates a pipeline).
- There is some work to be done to make sure that files written do not escape the currnet working directory.
- Make sure that files appended to are regular files.
cat 1.txt
# first file.
tar tf input.tar
# 1.txt
# 2.txt
tar-mux <(cat input.tar) <input.tar > double.tar
tar tf double.tar
# 1.txt
# 2.txt
# 1.txt
# 2.txt
tar-demux < double.tar
ls
# 1.txt 2.txt
cat 1.txt
# first file.first file.
- Jeff Nickoloff "[email protected]"
This project is released under the MIT license.