mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-17 11:16:34 -07:00
refactor(file)
This commit is contained in:
parent
e7b430f0d3
commit
e7576e085c
1 changed files with 2 additions and 16 deletions
18
file.go
18
file.go
|
|
@ -1,23 +1,9 @@
|
||||||
package bimg
|
package bimg
|
||||||
|
|
||||||
import (
|
import "io/ioutil"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Read(path string) ([]byte, error) {
|
func Read(path string) ([]byte, error) {
|
||||||
file, err := os.Open(path)
|
return ioutil.ReadFile(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 {
|
func Write(path string, buf []byte) error {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue