🏠 back to Observable

.tgz file is really a .tar file?

hi. from https://observablehq.com/@d3/multi-line-chart i clicked on the “Download code”, and received, in return, multi-line-chart.tgz. but, when i tried to zcat this file, i discovered it is not, in fact, a gzipped tar file, but rather an uncompressed tar file.

i’m somewhat new to the world of client-side (or any-other-side) javascript programming/packaging. but, from a unix perspective, this seems wrong.



.tgz files are described here
You should extract it using
tar -xzvf multi-line-chart.tgz

Hi @Cobus,

This post reads as if @minshall is pretty familiar with the .tar and tgz file types, and raises a good point. The downloaded file doesn’t appear to be compressed. If it were, you couldn’t rename it to .tar and run tar -xvf and have it still un-compress correctly… but you can!

zcat lets you cat a file without un-compressing it, but it will return an error on files not in gzip format. and it does return an error.

tar -xzvf includes an unnecessary un-compression command in this case, but tar doesn’t complain so you don’t notice it when the file is mislabelled.

So I think the Greg was just trying to flag that the extension on these files appears to be incorrect and that the files are uncompressed.


hi. yes, sorry, i was thinking earlier this evening i should have said another line or two. as the link @cobus pointed at (thanks), “.tgz”, to me, is short hand for “.tar.gz”, where “.tar” is the canonical ending people put on their, well, “.tar” files, and “.gz” is the ending the gzip compression utility, by default, adds to files it compresses.

so, “.tgz” should be (again, to my unix-y mind) a compressed tar file, not an uncompressed tar file. an uncompressed .tar file should (again, to me) have the ending “.tar”.



I think this is a bug. This tarball is intended to be gzipped, but it does not appear to be.


Good news! This bug is now fixed. The download is now an actual gzipped file. Please note that some platforms (e.g. Safari on MacOS), automatically uncompress this file to a .tar file when you download it.