repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

pico / shared / storage
Eric Bower · 09 Nov 24

memory.go

 1package storage
 2
 3import (
 4	"io"
 5
 6	sst "github.com/picosh/pobj/storage"
 7)
 8
 9type StorageMemory struct {
10	*sst.StorageMemory
11}
12
13func NewStorageMemory(sto map[string]map[string]string) (*StorageMemory, error) {
14	st, err := sst.NewStorageMemory(sto)
15	if err != nil {
16		return nil, err
17	}
18	return &StorageMemory{st}, nil
19}
20
21func (s *StorageMemory) ServeObject(bucket sst.Bucket, fpath string, opts *ImgProcessOpts) (io.ReadCloser, string, error) {
22	obj, _, err := s.GetObject(bucket, fpath)
23	return obj, GetMimeType(fpath), err
24}