filetype

package module
v0.0.0-...-2335e4a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

README

filetype

Support most of the document type detection and judgment in the market

Documentation

Index

Constants

View Source
const (
	// TAR 打包文件最小 1536 个字节
	TAR_MIN_SIZE = 1536
	// TAR 文件标志偏移量起始位置
	TAR_OFFSET_POSITION = 257
	// TAR 文件标志偏移量
	TAR_OFFSET_SIZE = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FILE_TYPE

type FILE_TYPE = string
const (
	// 可执行文件类型 PE
	FILE_TYPE_EXE FILE_TYPE = ".exe"
	FILE_TYPE_COM FILE_TYPE = ".com"
	FILE_TYPE_DLL FILE_TYPE = ".dll"
	// 可执行文件类型 ELF
	FILE_TYPE_BIN FILE_TYPE = ".bin"
	FILE_TYPE_SO  FILE_TYPE = ".so"
	// 文本类型
	FILE_TYPE_HTML FILE_TYPE = ".html"
	FILE_TYPE_HTM  FILE_TYPE = ".htm"
	FILE_TYPE_JSON FILE_TYPE = ".json"
	// 压缩类型
	FILE_TYPE_ZIP    FILE_TYPE = ".zip"
	FILE_TYPE_TAR    FILE_TYPE = ".tar"
	FILE_TYPE_GZ     FILE_TYPE = ".gz"
	FILE_TYPE_GZIP   FILE_TYPE = ".gz"
	FILE_TYPE_TGZ    FILE_TYPE = ".tgz"
	FILE_TYPE_TAR_GZ FILE_TYPE = ".tar.gz"

	// 视频类型
	FILE_TYPE_AVI  FILE_TYPE = ".avi"
	FILE_TYPE_MPG  FILE_TYPE = ".mpg"
	FILE_TYPE_RM   FILE_TYPE = ".rm"
	FILE_TYPE_WMV  FILE_TYPE = ".wmv"
	FILE_TYPE_FLV  FILE_TYPE = ".flv"
	FILE_TYPE_MP4  FILE_TYPE = ".mp4"
	FILE_TYPE_RMVB FILE_TYPE = ".rmvb"
	// 音频类型
	FILE_TYPE_MP3 FILE_TYPE = ".mp3"
	FILE_TYPE_WAV FILE_TYPE = ".wav"
	FILE_TYPE_WMA FILE_TYPE = ".wma"
	// 图片类型
	FILE_TYPE_JPG  FILE_TYPE = ".jpg"
	FILE_TYPE_BMP  FILE_TYPE = ".bmp"
	FILE_TYPE_GIF  FILE_TYPE = ".gif"
	FILE_TYPE_TIF  FILE_TYPE = ".tif"
	FILE_TYPE_PNG  FILE_TYPE = ".png"
	FILE_TYPE_JPEG FILE_TYPE = ".jpeg"
)

type FileType

type FileType struct {
}

func (*FileType) CheckFileType

func (f *FileType) CheckFileType(srcFile string, fileType FILE_TYPE) (is bool)

func (*FileType) GetFileType

func (f *FileType) GetFileType(srcFile string) (fileType string)

type IFileType

type IFileType interface {
	GetFileType(string) string
	CheckFileType(string, FILE_TYPE) bool
}

func NewFileType

func NewFileType() IFileType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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