I have a working version of a Go program that extracts a specific file inside a tar bzipped file. I'm using the standard library to
bzf := bzip2.NewReader(file)
tar := tar.NewReader(bzf)
// Iterate through tar archive until the file is found or end of input
for {
// Expensive operation!
header, err := tar.Next()
...
The problem is that for big files, the process of iterating is quite slow and it takes a long time in the case of extracting a file which is at the end of the tar.
I'm wondering if there are concurrent alternatives to this method that can make use of more than one core to accelerate the file extraction process.
Thanks for your help,
Pablo