mirror of https://github.com/talgo-cloud/bimg.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
354 B
26 lines
354 B
package bimg
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
func Read(path string) ([]byte, error) {
|
|
file, err := os.Open(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer file.Close()
|
|
|
|
buf, err := ioutil.ReadAll(file)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return buf, nil
|
|
}
|
|
|
|
func Write(path string, buf []byte) error {
|
|
return ioutil.WriteFile(path, buf, 0644)
|
|
}
|