PackageManager just because
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.

31 lines
574 B

package Filesystem
import (
"os"
bolt "go.etcd.io/bbolt"
)
func AddFileToBucket(bucket *bolt.Bucket, filePath string) error {
var (
fileObject FileObject
fileObjectBytes []byte
e error
)
fileObject, e = CreateFileObject(filePath)
if os.IsNotExist(e) {
return nil
}
if e != nil {
return e
}
fileObjectBytes, e = fileObject.ToBytes()
if e != nil {
return e
}
return bucket.Put([]byte(filePath), fileObjectBytes)
}
func RemoveFileFromBucket(bucket *bolt.Bucket, filePath string) error {
return bucket.Delete([]byte(filePath))
}