Adds the ability to read gzip-tar file for the taxonomy dump

This commit is contained in:
Eric Coissac
2025-01-24 11:47:59 +01:00
parent ffd67252c3
commit 3137c1f841
17 changed files with 305 additions and 64 deletions

20
pkg/obiutils/tar.go Normal file
View File

@ -0,0 +1,20 @@
package obiutils
import (
"archive/tar"
"fmt"
)
func TarFileReader(file *Reader, path string) (*tar.Reader, error) {
tarfile := tar.NewReader(file)
header, err := tarfile.Next()
for err == nil {
if header.Name == path {
return tarfile, nil
}
header, err = tarfile.Next()
}
return nil, fmt.Errorf("file not found: %s", path)
}