Documentation ¶
Overview ¶
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.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInfo ¶
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 ¶
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.
Example ¶
Example FileBytes
// Create a tiny GIF image file fi, err := magic.FileBytes(tiniestGifEver) if err == nil { fmt.Printf("The file type is %s", fi.Description) }
Output: The file type is GIF89a Image
Click to show internal directories.
Click to hide internal directories.