refactor(resize): extract

This commit is contained in:
Tomas Aparicio 2015-04-06 23:43:30 +02:00
parent d9eac32a9a
commit 3904953399
9 changed files with 246 additions and 173 deletions

View file

@ -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)
}