summaryrefslogtreecommitdiff
path: root/workhorse/internal/utils/svg/README.md
blob: e5531f47473f2d34262160e452293e3c784fe764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# go-is-svg

Tiny package to verify if a given file buffer is an SVG image in Go (golang).

## Installation

```bash
go get -u github.com/h2non/go-is-svg
```

## Example

```go
package main

import (
	"fmt"
	"io/ioutil"

	svg "github.com/h2non/go-is-svg"
)

func main() {
	buf, err := ioutil.ReadFile("_example/example.svg")
	if err != nil {
		fmt.Printf("Error: %s\n", err)
		return
	}

	if svg.Is(buf) {
		fmt.Println("File is an SVG")
	} else {
		fmt.Println("File is NOT an SVG")
	}
}
```

Run example:
```bash
go run _example/example.go
```

## License

MIT - Tomas Aparicio