I'm trying to decompress a zip file in golang (with password).
r, err := zip.OpenReader("./path/to/the.zip")
if err != nil {
log.Fatal(err)
}
defer r.Close()
for _, f := range r.File {
if f.IsEncrypted() {
f.SetPassword("$83?Lu{5nKbXxncjdH/_B)+}C`")
}
r, err := f.Open()
if err != nil {
log.Fatal(err)
}
buf, err := ioutil.ReadAll(r)
if err != nil {
log.Fatal(err)
}
defer r.Close()
fmt.Printf("Size of %v: %v byte(s)
", f.Name, len(buf))
}
I'm at this point where using the repository https://github.com/yeka/zip I get the following output:
Size of cmxxxgapi/: 0 byte(s)
Size of cmxpi/vxxxxxxxx.yml: 326 byte(s)
Size of cmxxxpi/valxxxxxxe.yml: 379 byte(s)
Size of validations_javxxxo_mxxxxxxxon.yml: 722 byte(s)
Size of validations_xxx_mxxxxxxxxo.yml: 4322 byte(s)
Size of validations_xxxxse.yml: 65 byte(s)
How can I decompress all those files and have them accessible from my binary.
Thank you very much.
Ps. I can't use exec.