Standard library / archive/zip

archive/zip.FileHeader.FileInfo()

Expose entry metadata through fs.FileInfo, not a real filesystem stat. Expected stdout: 'a.txt 2\n'.

Formal Syntax & Structure

go syntaxgo
func (h *FileHeader) FileInfo() fs.FileInfo

Return Value

fs.FileInfo

Metadata as a filesystem interface.

Working Example

Example Snippetgo
package main
import (  "archive/zip"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  h := zip.FileHeader{Name: "sub/a.txt", UncompressedSize64: 2}  fmt.Println(h.FileInfo().Name(), h.FileInfo().Size())}
Go Reference