mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Add capacity to obidistribute to save gzipped files
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils"
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiiter"
|
||||
)
|
||||
|
||||
@ -55,18 +56,13 @@ func WriteSequencesToFile(iterator obiiter.IBioSequence,
|
||||
filename string,
|
||||
options ...WithOption) (obiiter.IBioSequence, error) {
|
||||
|
||||
var file *os.File
|
||||
var err error
|
||||
|
||||
opt := MakeOptions(options)
|
||||
|
||||
if opt.AppendFile() {
|
||||
log.Debug("Open files in appending mode")
|
||||
file, err = os.OpenFile(filename,
|
||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
} else {
|
||||
file, err = os.Create(filename)
|
||||
}
|
||||
file, err := goutils.OpenWritingFile(filename,
|
||||
opt.CompressedFile(),
|
||||
opt.AppendFile(),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("open file error: %v", err)
|
||||
|
Reference in New Issue
Block a user