3 ms·
> I've often felt we need an abstraction for just this. "Bring your own storage" I made exactly this: https://github.com/mickael-kerjean/filestash https://gith
by mickael-kerjean 3y ago
> I've often felt we need an abstraction for just this. "Bring your own storage"
I made exactly this: https://github.com/mickael-kerjean/filestash https://github.com/mickael-kerjean/filestash The public API enables programmatical access to S3, SFTP, FTP, GIT, WebDav, Samba, Local FS, NFS, Backblaze, Storj, Artifactory, .... and more. Under the hood, each storage implements this interface:
type IBackend interface {
Ls(path string) ([]os.FileInfo, error)
Cat(path string) (io.ReadCloser, error)
Mkdir(path string) error
Rm(path string) error
Mv(from string, to string) error
Save(path string, file io.Reader) error
Touch(path string) error
}
There's some hook so you can define your own and do even more funky stuff like virtual FS wich compose onto anything you want/need. There's a bunch of weird implementation like the mysql storage, which represent first level folders as databases, second level folders as tables and files as the actual rows.
fun fact: it was born out of a reflection from the infamous top comment of the Dropbox launch on HN
- freedomben 3y agoWhoa, this is a solution I've looked for several times and can never find. Thanks!