mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 09:20:29 -07:00
feat: add file helper
This commit is contained in:
parent
ef10d7d7ec
commit
37dd5f1d27
3 changed files with 42 additions and 2 deletions
20
file.go
Normal file
20
file.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package bimg
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func Read(path string) ([]byte, error) {
|
||||
data, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return buf, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue