github.com/cidverse/cid-sdk-go@v0.0.0-20240318001225-c193d83f053e/archive.go (about)

     1  package cidsdk
     2  
     3  import (
     4  	"github.com/cidverse/cidverseutils/pkg/archive/tar"
     5  	"github.com/cidverse/cidverseutils/pkg/archive/zip"
     6  )
     7  
     8  // ZIPCreate creates a zip archive of the directory at the given path.
     9  func (sdk SDK) ZIPCreate(inputDirectory string, outputFile string) error {
    10  	return zip.Create(inputDirectory, outputFile)
    11  }
    12  
    13  // ZIPExtract unzips the zip archive at the given path into the given directory.
    14  func (sdk SDK) ZIPExtract(archiveFile string, outputDirectory string) error {
    15  	return zip.Extract(archiveFile, outputDirectory)
    16  }
    17  
    18  // TARCreate creates a tar archive of the directory at the given path.
    19  func (sdk SDK) TARCreate(inputDirectory string, outputFile string) error {
    20  	return tar.Create(inputDirectory, outputFile)
    21  }
    22  
    23  // TARExtract extracts a tar archive at the given path into the given directory.
    24  func (sdk SDK) TARExtract(archiveFile string, outputDirectory string) error {
    25  	return tar.Extract(archiveFile, outputDirectory)
    26  }