Skip to content

Commit c768e06

Browse files
committed
update readme
1 parent 1f3f5f5 commit c768e06

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,41 @@ func main() {
4343
fmt.Println(valid)
4444
```
4545
46+
One Of
47+
```go
48+
package main
49+
50+
import (
51+
"fmt"
52+
"github.com/telkomdev/go-filesig"
53+
"os"
54+
)
55+
56+
func main() {
57+
args := os.Args
58+
59+
if len(args) < 2 {
60+
fmt.Println("required input file")
61+
os.Exit(1)
62+
}
63+
64+
inputFileArg := args[1]
65+
inFile, err := os.Open(inputFileArg)
66+
67+
if err != nil {
68+
fmt.Println("error open input file ", err)
69+
os.Exit(1)
70+
}
71+
72+
defer func() { inFile.Close() }()
73+
74+
valid := filesig.IsOneOf(inFile, filesig.Is3gp, filesig.IsPng, filesig.IsJpeg)
75+
fmt.Println(valid)
76+
77+
}
78+
79+
```
80+
4681
HTTP Form File
4782
```go
4883
package main

0 commit comments

Comments
 (0)