Search code examples
metadatago

Load file metadata with go


Does anyone know of a way to read the metadata and or properties of a file using the go language?


Solution

  • package main
    
    import (
        "fmt"
        "os"
    )
    
    func main() {
        fi, err := os.Stat("filename")
        if err != nil {
            fmt.Println(err)
            return
        }
        fmt.Println(fi.Name(), fi.Size())
    }