mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-16 02:45:54 -07:00
refactor(resize): extract
This commit is contained in:
parent
d9eac32a9a
commit
3904953399
9 changed files with 246 additions and 173 deletions
9
file.go
9
file.go
|
|
@ -6,15 +6,20 @@ import (
|
|||
)
|
||||
|
||||
func Read(path string) ([]byte, error) {
|
||||
data, err := os.Open(path)
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
buf, err := ioutil.ReadAll(data)
|
||||
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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue