38 lines
596 B
Go
38 lines
596 B
Go
package server
|
|
|
|
import (
|
|
"bytes"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
type BindataFileSystem struct{}
|
|
|
|
func (f BindataFileSystem) Open(name string) (http.File, error) {
|
|
path := "dist" + name
|
|
|
|
data, err := Asset(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &BindataFile{bytes.NewReader(data), path}, nil
|
|
}
|
|
|
|
type BindataFile struct {
|
|
*bytes.Reader
|
|
path string
|
|
}
|
|
|
|
func (f *BindataFile) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (f *BindataFile) Readdir(count int) ([]os.FileInfo, error) {
|
|
return make([]os.FileInfo, 0), nil
|
|
}
|
|
|
|
func (f *BindataFile) Stat() (os.FileInfo, error) {
|
|
return AssetInfo(f.path)
|
|
}
|