fs

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(raw json.RawMessage, conn Conn) (interface{}, error)

Download creates a tar archive of the given path and sends it as a binary frame.

func List

func List(raw json.RawMessage) (interface{}, error)

List returns directory entries.

func Mkdir

func Mkdir(raw json.RawMessage) (interface{}, error)

Mkdir creates a directory.

func Read

func Read(raw json.RawMessage, conn Conn) (interface{}, error)

Read reads a file and sends its content as binary frame(s) followed by a JSON result. Files larger than the chunk threshold are sent as multiple binary frames.

func Remove

func Remove(raw json.RawMessage) (interface{}, error)

Remove removes a file or directory.

func Rename

func Rename(raw json.RawMessage) (interface{}, error)

Rename renames a file or directory.

func Stat

func Stat(raw json.RawMessage) (interface{}, error)

Stat returns file info for a path.

func Upload

func Upload(raw json.RawMessage, conn Conn) (interface{}, error)

Upload reads a binary frame containing tar data and extracts it to the given path.

func Write

func Write(raw json.RawMessage, conn Conn) (interface{}, error)

Write reads binary frame(s) from conn and writes them to the file at path. If chunked is true, it reads the specified number of chunk frames.

Types

type Conn

type Conn = io.ReadWriter

Conn is an alias for io.ReadWriter used by handlers that need binary frame I/O.

type FileInfo

type FileInfo struct {
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	IsDir   bool      `json:"is_dir"`
	Mode    uint32    `json:"mode"`
	ModTime time.Time `json:"mod_time"`
}

FileInfo is a serializable file info entry.

type MkdirParams

type MkdirParams struct {
	Path      string `json:"path"`
	Recursive bool   `json:"recursive,omitempty"`
}

MkdirParams is the params for fs.mkdir.

type PathParams

type PathParams struct {
	Path string `json:"path"`
}

PathParams is shared params with a path field.

type RemoveParams

type RemoveParams struct {
	Path      string `json:"path"`
	Recursive bool   `json:"recursive,omitempty"`
}

RemoveParams is the params for fs.remove.

type RenameParams

type RenameParams struct {
	Old string `json:"old"`
	New string `json:"new"`
}

RenameParams is the params for fs.rename.

type WriteParams

type WriteParams struct {
	Path    string `json:"path"`
	Size    int    `json:"size"`
	Chunked bool   `json:"chunked,omitempty"`
	Chunks  int    `json:"chunks,omitempty"`
}

WriteParams is the params for fs.write.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL