Skip to content

Instantly share code, notes, and snippets.

@mrtrkmn
Created April 19, 2021 01:05
Show Gist options
  • Save mrtrkmn/647047d6ac4cce77ec75fce33ccc0834 to your computer and use it in GitHub Desktop.
Save mrtrkmn/647047d6ac4cce77ec75fce33ccc0834 to your computer and use it in GitHub Desktop.
package client
type Tar struct {
c *Client
}
// exec executes an ExecFunc using 'tar' command.
func (tr *Tar) exec(args ...string) ([]byte, error) {
return tr.c.exec("tar", args...)
}
// CompressWithPIGZ using tar with pigz compress program to compress given data
func (tr *Tar) CompressWithPIGZ(fileName, folderToCompress string) error {
cmds := []string{"--use-compress-program=pigz", "-cf", fileName, folderToCompress}
_, err := tr.exec(cmds...)
if err != nil {
return err
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment