Documentation ¶
Index ¶
- Constants
- Variables
- func ContentTypeByPath(s string) string
- func NewPromise[T any]() *promise[T]
- func NewWritableDirFS(path string) *writableDirFS
- type CachedThumbnailer
- type CreateFS
- type FSCapability
- type FSClient
- func (c *FSClient) Abort() error
- func (c *FSClient) Create(name string) (io.WriteCloser, error)
- func (c *FSClient) HandleMessage(data []byte, isjson bool) error
- func (c *FSClient) Mkdir(name string, mode fs.FileMode) error
- func (c *FSClient) Open(name string) (fs.File, error)
- func (c *FSClient) OpenDir(name string) (fs.ReadDirFile, error)
- func (c *FSClient) OpenWriter(name string, flag int) (io.WriteCloser, error)
- func (c *FSClient) ReadDir(name string) ([]fs.DirEntry, error)
- func (c *FSClient) ReadDirRange(name string, pos, limit int) ([]fs.DirEntry, error)
- func (c *FSClient) Remove(name string) error
- func (c *FSClient) Rename(name string, newName string) error
- func (c *FSClient) Stat(name string) (fs.FileInfo, error)
- func (c *FSClient) Truncate(name string, size int64) error
- type FSServer
- type FileEntry
- type FileOperationRequest
- type FileOperationResult
- type MkdirFS
- type OpenDirFS
- type OpenWriterFS
- type RealPathResolver
- type RemoveFS
- type RenameFS
- type Thumbnail
- type Thumbnailer
- type ThumbnailerGroup
- type TruncateFS
- type WrappedFS
- func (w *WrappedFS) Capability() *FSCapability
- func (w *WrappedFS) Create(name string) (io.WriteCloser, error)
- func (w *WrappedFS) Mkdir(path string, mode fs.FileMode) error
- func (w *WrappedFS) OpenWriter(name string, flag int) (io.WriteCloser, error)
- func (w *WrappedFS) ReadDir(name string) ([]fs.DirEntry, error)
- func (w *WrappedFS) ReadOnly() *WrappedFS
- func (w *WrappedFS) Remove(name string) error
- func (w *WrappedFS) Rename(name, newName string) error
- func (w *WrappedFS) Stat(name string) (fs.FileInfo, error)
- func (w *WrappedFS) Truncate(name string, size int64) error
Constants ¶
View Source
const BinaryMessageResponseType = 0
View Source
const ThumbnailSuffix = "#thumbnail.jpeg"
View Source
const ThumbnailWidth = 160
Variables ¶
View Source
var DefaultThumbnailer = ThumbnailerGroup{}
View Source
var ErrNotSupported = errors.New("Not supported format")
Functions ¶
func ContentTypeByPath ¶
func NewPromise ¶
func NewPromise[T any]() *promise[T]
func NewWritableDirFS ¶
func NewWritableDirFS(path string) *writableDirFS
Types ¶
type CachedThumbnailer ¶
type CachedThumbnailer struct { CacheDir string SupportedFunc func(typ string) bool GenerateFunc func(ctx context.Context, f fs.FS, src, dst string) error // contains filtered or unexported fields }
func NewImageThumbnailer ¶
func NewImageThumbnailer(cacheDir string) *CachedThumbnailer
func NewVideoThumbnailer ¶
func NewVideoThumbnailer(cacheDir, ffmpegPath string) *CachedThumbnailer
func (*CachedThumbnailer) GetThumbnail ¶
func (*CachedThumbnailer) Supported ¶
func (t *CachedThumbnailer) Supported(typ string) bool
type CreateFS ¶ added in v0.1.3
type CreateFS interface {
Create(path string) (io.WriteCloser, error)
}
type FSCapability ¶
type FSClient ¶
type FSClient struct { MaxReadSize int Timeout time.Duration // contains filtered or unexported fields }
FSClient implements fs.FS
func NewFSClient ¶
func NewFSClient(sendFunc func(req *FileOperationRequest) error) *FSClient
func (*FSClient) OpenWriter ¶
func (*FSClient) ReadDirRange ¶
type FSServer ¶
type FSServer struct {
// contains filtered or unexported fields
}
func (*FSServer) FSCaps ¶ added in v0.1.3
func (s *FSServer) FSCaps() *FSCapability
func (*FSServer) HandleMessage ¶
func (*FSServer) HanldeFileOp ¶
func (h *FSServer) HanldeFileOp(op *FileOperationRequest) (any, error)
type FileEntry ¶
type FileEntry struct { Type string `json:"type"` FileName string `json:"name"` FileSize int64 `json:"size"` UpdatedTime int64 `json:"updatedTime,omitempty"` CreatedTime int64 `json:"createdTime,omitempty"` Writable bool `json:"writable,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` }
func (*FileEntry) SetMetaData ¶
type FileOperationRequest ¶
type FileOperationRequest struct { Op string `json:"op"` RID any `json:"rid,omitempty"` Path string `json:"path,omitempty"` Path2 string `json:"path2,omitempty"` Pos int64 `json:"p,omitempty"` Len int `json:"l,omitempty"` Buf []byte `json:"b,omitempty"` }
func (*FileOperationRequest) ToBytes ¶
func (r *FileOperationRequest) ToBytes() []byte
type FileOperationResult ¶
type FileOperationResult struct { RID any `json:"rid,omitempty"` Data json.RawMessage `json:"data,omitempty"` Error string `json:"error,omitempty"` Buf []byte `json:"b,omitempty"` }
func (*FileOperationResult) IsJSON ¶
func (r *FileOperationResult) IsJSON() bool
func (*FileOperationResult) ToBytes ¶
func (r *FileOperationResult) ToBytes() []byte
type OpenWriterFS ¶ added in v0.1.3
type OpenWriterFS interface {
OpenWriter(name string, flag int) (io.WriteCloser, error)
}
type RealPathResolver ¶
type Thumbnailer ¶
type ThumbnailerGroup ¶
type ThumbnailerGroup struct {
Thumbnailers []Thumbnailer
}
func (ThumbnailerGroup) GetThumbnail ¶
func (*ThumbnailerGroup) Register ¶
func (g *ThumbnailerGroup) Register(t Thumbnailer)
func (ThumbnailerGroup) Supported ¶
func (g ThumbnailerGroup) Supported(typ string) bool
type TruncateFS ¶ added in v0.1.3
type WrappedFS ¶ added in v0.1.3
func (*WrappedFS) Capability ¶ added in v0.1.3
func (w *WrappedFS) Capability() *FSCapability
func (*WrappedFS) Create ¶ added in v0.1.3
func (w *WrappedFS) Create(name string) (io.WriteCloser, error)
func (*WrappedFS) OpenWriter ¶ added in v0.1.3
Click to show internal directories.
Click to hide internal directories.