Determine the type of file based on it's magic-bytes
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE.md
README.md
file_signatures.go
magic.go
magic_test.go

README.md

GoDoc MarkMueller MarkMueller

magic

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

Package files

file_signatures.go magic.go

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

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