You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
479 B
23 lines
479 B
10 years ago
|
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)
|
||
|
}
|