Extracting tar files

This blog will explain you how to extract the tar file using go.

Tar files contain the header which we need to understand to extract the content of the tar file. For much details follow the blog from @vladimirvivien.

Extracting a tar file is three step process :

  1. Read the file as io.Reader.
  2. Create gzip.Reader from io.Reader.
  3. Create tar.Reader from gzip.Reader.
  4. Use this new reader to process the zipped file iteratively.
Written on August 6, 2022