mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
23 lines
479 B
Go
23 lines
479 B
Go
|
package minio
|
||
|
|
||
|
import (
|
||
|
"io/ioutil"
|
||
|
"os"
|
||
|
"path"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
type FileStorage struct {
|
||
|
RootDir string
|
||
|
}
|
||
|
|
||
|
func (storage FileStorage) Get(objectPath string) ([]byte, error) {
|
||
|
return ioutil.ReadFile(path.Join(storage.RootDir, objectPath))
|
||
|
|
||
|
}
|
||
|
|
||
|
func (storage FileStorage) Put(objectPath string, object []byte) error {
|
||
|
os.MkdirAll(filepath.Dir(path.Join(storage.RootDir, objectPath)), 0700)
|
||
|
return ioutil.WriteFile(path.Join(storage.RootDir, objectPath), object, 0600)
|
||
|
}
|