Skip to content

ijaa/filetype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filetype

golang package for file type checking and just need the file path param, also this package only gets minimized file content for checking logic, which is friendly to big size file.

Examples

Simple file type check

package main

import (
    "fmt"

    "github.com/ijaa/filetype"
)

func main() {

    ok, _ := filetype.Is(filetype.TypeJpeg, "./sample.jpg")
	if !ok {
		fmt.Println("this file is not jpg")
    }
    
    ok, _ := filetype.IsIn([]filetype.FileType{filetype.TypeJpeg,filetype.TypePng}, "./sample.jpg")
	if !ok {
		fmt.Println("this file is not jpg or png")
	}
}

About

golang package for file type checking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages