Skip to content

mkmueller/magic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc MarkMueller MarkMueller

magic

Package magic will determine the type of file based on the first "magic bytes". The file signatures are not complete, but represent some of the most common file types.

file_signatures.go magic.go

type FileInfo struct {

    // Name of the file
    Name string

    // Comma delimited list of known extensions for this file type
    Ext []string

    // Description of the file
    Description string

    // Size of the file in bytes
    Size int64
}

FileInfo struct

func FileBytes(file string) (FileInfo, error)

FileBytes returns a FileInfo struct. The error will be non-nil if the file type cannot be determined or if the file cannot be read.


Generated by godoc2md

About

Determine the type of file based on it's magic-bytes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages