magic

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2018 License: BSD-2-Clause-Views Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MAGIC_NONE              = C.MAGIC_NONE
	MAGIC_DEBUG             = C.MAGIC_DEBUG
	MAGIC_SYMLINK           = C.MAGIC_SYMLINK
	MAGIC_COMPRESS          = C.MAGIC_COMPRESS
	MAGIC_DEVICES           = C.MAGIC_DEVICES
	MAGIC_MIME_TYPE         = C.MAGIC_MIME_TYPE
	MAGIC_CONTINUE          = C.MAGIC_CONTINUE
	MAGIC_CHECK             = C.MAGIC_CHECK
	MAGIC_PRESERVE_ATIME    = C.MAGIC_PRESERVE_ATIME
	MAGIC_RAW               = C.MAGIC_RAW
	MAGIC_ERROR             = C.MAGIC_ERROR
	MAGIC_MIME_ENCODING     = C.MAGIC_MIME_ENCODING
	MAGIC_MIME              = C.MAGIC_MIME
	MAGIC_APPLE             = C.MAGIC_APPLE
	MAGIC_NO_CHECK_COMPRESS = C.MAGIC_NO_CHECK_COMPRESS
	MAGIC_NO_CHECK_TAR      = C.MAGIC_NO_CHECK_TAR
	MAGIC_NO_CHECK_SOFT     = C.MAGIC_NO_CHECK_SOFT
	MAGIC_NO_CHECK_APPTYPE  = C.MAGIC_NO_CHECK_APPTYPE
	MAGIC_NO_CHECK_ELF      = C.MAGIC_NO_CHECK_ELF
	MAGIC_NO_CHECK_TEXT     = C.MAGIC_NO_CHECK_TEXT
	MAGIC_NO_CHECK_CDF      = C.MAGIC_NO_CHECK_CDF
	MAGIC_NO_CHECK_TOKENS   = C.MAGIC_NO_CHECK_TOKENS
	MAGIC_NO_CHECK_ENCODING = C.MAGIC_NO_CHECK_ENCODING
	MAGIC_NO_CHECK_ASCII    = C.MAGIC_NO_CHECK_ASCII
	MAGIC_NO_CHECK_FORTRAN  = C.MAGIC_NO_CHECK_FORTRAN
	MAGIC_NO_CHECK_TROFF    = C.MAGIC_NO_CHECK_TROFF
)

Variables

This section is empty.

Functions

func AddMagicDir

func AddMagicDir(dir string) error

Add a directory for libmagic to search for .mgc databases.

func Buffer

func Buffer(cookie Magic, b []byte) string

func Check

func Check(cookie Magic, filename string) int

func Close

func Close(cookie Magic)

func Compile

func Compile(cookie Magic, filename string) int

func Errno

func Errno(cookie Magic) int

func Error

func Error(cookie Magic) string

func File

func File(cookie Magic, filename string) string

func GetDefaultDir

func GetDefaultDir() string

Find the real magic file location

func Load

func Load(cookie Magic, filename string) int

func MimeFromBytes

func MimeFromBytes(b []byte) string

Get mimetype from a buffer.

func MimeFromFile

func MimeFromFile(path string) string

Get mimetype from a file.

func SetFlags

func SetFlags(cookie Magic, flags int) int

Types

type Magic

type Magic C.magic_t

func Open

func Open(flags int) Magic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL