Created
April 19, 2021 01:05
-
-
Save mrtrkmn/647047d6ac4cce77ec75fce33ccc0834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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