Skip to content

Instantly share code, notes, and snippets.

@edsrzf
Created April 23, 2011 01:23
Show Gist options
  • Save edsrzf/938100 to your computer and use it in GitHub Desktop.
Save edsrzf/938100 to your computer and use it in GitHub Desktop.
Untar a tarball with Go
package main
import (
"archive/tar"
"io"
"os"
)
func main() {
f, _ := os.Open("archive.tar")
defer f.Close()
untarred, _ := os.Create("untarred")
defer untarred.Close()
tarReader := tar.NewReader(f)
io.Copy(untarred, tarReader)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment