mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-11-10 01:24:41 +00:00
Adds the ability to read gzip-tar file for the taxonomy dump
This commit is contained in:
1 parent
ffd67252c3
commit
3137c1f841
17 files changed
+305
-64
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user