1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-11-15 04:58:36 +00:00

Add --compress flag to tar-split asm

The Go implementation of gzip is the only known to produce compressed
layers with the expected digest hashes.

This change allows compressed tar layer files to be produced, which is
useful for exporting layers from non-Go tools.
This commit is contained in:
Steve Baker 2018-10-18 12:57:54 +13:00
parent 61b49a82bb
commit dbab9ab4fb
2 changed files with 11 additions and 0 deletions

View file

@ -37,6 +37,12 @@ func CommandAsm(c *cli.Context) {
outputStream = fh
}
if c.Bool("compress") {
zipper := gzip.NewWriter(outputStream)
defer zipper.Close()
outputStream = zipper
}
// Get the tar metadata reader
mf, err := os.Open(c.String("input"))
if err != nil {

View file

@ -69,6 +69,11 @@ func main() {
Value: "",
Usage: "relative path of extracted tar",
},
cli.BoolFlag{
Name: "compress",
Usage: "gzip compress the output",
// defaults to false
},
},
},
{