File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
12
12
"path/filepath"
13
13
"sync"
14
14
15
- _ "github.com/ulikunitz/xz"
15
+ "github.com/ulikunitz/xz"
16
16
)
17
17
18
18
const DebugFullfiles = false
@@ -25,6 +25,7 @@ var fullfileCompressors = []struct {
25
25
ExternalTarExtraArg string
26
26
}{
27
27
{"gzip" , compressGzip , "" },
28
+ {"xz" , compressXZ , "" },
28
29
{"external-tar-bzip2" , nil , "--bzip2" },
29
30
{"external-tar-gzip" , nil , "--gzip" },
30
31
{"external-tar-xz" , nil , "--xz" },
@@ -345,3 +346,15 @@ func compressGzip(dst io.Writer, src io.Reader) error {
345
346
}
346
347
return gw .Close ()
347
348
}
349
+
350
+ func compressXZ (dst io.Writer , src io.Reader ) error {
351
+ xw , err := xz .NewWriter (dst )
352
+ if err != nil {
353
+ return err
354
+ }
355
+ _ , err = io .Copy (xw , src )
356
+ if err != nil {
357
+ return err
358
+ }
359
+ return xw .Close ()
360
+ }
You can’t perform that action at this time.
0 commit comments