Initial commit
This commit is contained in:
commit
55a1efa08f
60 changed files with 5485 additions and 0 deletions
3
lang/go/utils/unzip-one/go.mod
Normal file
3
lang/go/utils/unzip-one/go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module puck.moe/zilch/go/unzip-one
|
||||
|
||||
go 1.22.5
|
||||
32
lang/go/utils/unzip-one/main.go
Normal file
32
lang/go/utils/unzip-one/main.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f, err := zip.OpenReader(os.Args[1])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
in, err := f.Open(os.Args[2])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
out, err := os.OpenFile(os.Getenv("out"), os.O_CREATE|os.O_RDWR, 0666)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if _, err := io.Copy(out, in); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
out.Close()
|
||||
in.Close()
|
||||
f.Close()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue