file.go 358 B

123456789101112131415
  1. package bimg
  2. import "io/ioutil"
  3. // Read reads all the content of the given file path
  4. // and returns it as byte buffer.
  5. func Read(path string) ([]byte, error) {
  6. return ioutil.ReadFile(path)
  7. }
  8. // Write writes the given byte buffer into disk
  9. // to the given file path.
  10. func Write(path string, buf []byte) error {
  11. return ioutil.WriteFile(path, buf, 0644)
  12. }