-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
unzip.go
50 lines (46 loc) · 1.03 KB
/
unzip.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package artifact_diff
import (
"golift.io/xtractr"
)
func Unzip(src, dest string) error {
x := &xtractr.XFile{
FilePath: src,
OutputDir: dest,
FileMode: 0777,
DirMode: 0755,
}
_, files, err := xtractr.ExtractZIP(x)
if err != nil || files == nil {
return err
}
//log.Println("Bytes written:", size, "Files Extracted:\n -", strings.Join(files, "\n -"))
return nil
}
func Gunzip(src, dest string) error {
x := &xtractr.XFile{
FilePath: src,
OutputDir: dest,
FileMode: 0777,
DirMode: 0755,
}
_, files, err := xtractr.ExtractGzip(x)
if err != nil || files == nil {
return err
}
//log.Println("Bytes written:", size, "Files Extracted:\n -", strings.Join(files, "\n -"))
return nil
}
func Untar(src, dest string) error {
x := &xtractr.XFile{
FilePath: src,
OutputDir: dest,
FileMode: 0777,
DirMode: 0755,
}
_, files, err := xtractr.ExtractTar(x)
if err != nil || files == nil {
return err
}
//log.Println("Bytes written:", size, "Files Extracted:\n -", strings.Join(files, "\n -"))
return nil
}