tstor/torrent/binary_fs.go
Antonio Navarro Perez ecd524ed3c First functional web interface version.
- Simplify by now all html and javascript.
- Added a simple interface using go templates and plain javascript.
- Improved REST interface for the use case.
- Changed some properties into the config file to make it suitable for
future use cases.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2020-05-18 19:42:23 +02:00

24 lines
444 B
Go

package distribyted
import (
"net/http"
"strings"
)
type binaryFileSystem struct {
http.FileSystem
}
func NewBinaryFileSystem(fs http.FileSystem) *binaryFileSystem {
return &binaryFileSystem{fs}
}
func (fs *binaryFileSystem) Exists(prefix string, filepath string) bool {
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
if _, err := fs.Open(p); err != nil {
return false
}
return true
}
return false
}