Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Torkus committed Mar 21, 2024
0 parents commit 1e3af8e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.zip
*~
readzip
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module readzip

go 1.21.6
29 changes: 29 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import (
"archive/zip"
"fmt"
"os"
)

func main() {

rdr, err := os.Open("bigfile.zip")
if err != nil {
panic("failed to open file: " + err.Error())
}

finfo, err := rdr.Stat()
if err != nil {
panic("failed to read file info: " + err.Error())
}

zrdr, err := zip.NewReader(rdr, finfo.Size())
if err != nil {
panic("failed to open a zip reader: " + err.Error())
}

for _, f := range zrdr.File {
fmt.Println(f.FileInfo())
}
}

0 comments on commit 1e3af8e

Please sign in to comment.