diff options
Diffstat (limited to 'file/file.go')
-rw-r--r-- | file/file.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/file/file.go b/file/file.go index 4267b10..9bb974d 100644 --- a/file/file.go +++ b/file/file.go @@ -24,6 +24,16 @@ func Read(f *os.File) ([]byte, error) { return bs, nil } +func ReadFile(path string) ([]byte, error) { + f, err := os.Open(path) + if err != nil { + return []byte{}, err + } + defer f.Close() + + return Read(f) +} + func Write(f *os.File, content []byte) error { n, err := f.Write(content) if n != len(content) { |