mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08: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
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
import "io/ioutil"
|
||||
|
||||
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
|
||||
return ioutil.ReadFile(path)
|
||||
}
|
||||
|
||||
func Write(path string, buf []byte) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue