tar is a Tcllib package for handling tar data.
To work with a gzipped tar file:
#! /bin/env tclsh package require tar set chan [open myfile.tar.gz] zlib push gunzip $chan set data [::tar::get $chan some_file_in_tarball -chan] close $chan
#! /bin/env tclsh package require tar set chan [open myfile.tar.gz w] zlib push gzip $chan tar::create $chan list_of_files -chan close $chan
mrcalvin - 2018-05-29 23:38:45
The channels should be opened in binary mode, either by passing wb and rb, respectively, or setting fconfigure -translation binary explicitly. Otherwise, the above examples will fail in unexpected ways.