try filetype

This commit is contained in:
ed 2019-12-18 14:10:48 +01:00
parent 910651390d
commit 0f63ceedbe
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"syscall" "syscall"
"github.com/h2non/filetype"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
) )
@ -130,6 +131,10 @@ func main() {
FileName = readFn() FileName = readFn()
fn := FileName fn := FileName
fmt.Println(fn) fmt.Println(fn)
data := file2data(fn)
fType, _ := filetype.Get(data)
fmt.Println(fType.Extension)
os.Exit(0)
mode := getMode() mode := getMode()
switch mode { switch mode {
case "h": case "h":