add HttpFS.Remove()

This commit is contained in:
S.Solodyagin
2025-10-28 12:27:44 +03:00
parent 42298fe1e3
commit f5f2b75284
4 changed files with 31 additions and 25 deletions
+8 -4
View File
@@ -2,7 +2,6 @@ package filestore
import (
"net/http"
"strings"
"git.company.lan/gopkg/filestore/remote"
)
@@ -44,13 +43,18 @@ func NewHttpFS(dir string, opts ...HttpFSOption) (*HttpFS, error) {
// Open
func (f *HttpFS) Open(name string) (http.File, error) {
n := strings.TrimPrefix(name, "/")
if f.remoteStorage != nil {
return f.remoteStorage.Open(name)
}
return f.localStorage.Open(name)
}
return f.localStorage.Open(n)
// Remove
func (f *HttpFS) Remove(name string) error {
if f.remoteStorage != nil {
return f.remoteStorage.Remove(name)
}
return f.localStorage.Remove(name)
}
// LocalStorage