Documentation
¶
Overview ¶
Package fs exposes the filesystem operations the daemon allows remote browsers to perform. All paths must be absolute; relative paths are rejected as a defense against traversal.
Index ¶
- Constants
- Variables
- func BrowseDir(path, scopeRoot string) ([]protocol.BrowseEntry, error)
- func BuildContextRefBlock(root string, refs []protocol.ContextRef, limits ContextRefLimits) string
- func MkDir(path, scopeRoot string) error
- func ReadFile(path, scopeRoot string, maxBytes int) (string, bool, error)
- func ReadFileWithAllowedPaths(path, scopeRoot string, maxBytes int, exactAllowedPaths []string) (string, bool, error)
- func ResolveExistingPathFromCWD(path string, cwd string) (string, error)
- type BrowseDirOptions
- type BrowseDirPage
- type ContextRefLimits
Constants ¶
View Source
const DefaultMaxBytes = 512 * 1024
DefaultMaxBytes is the default file size cap.
Variables ¶
View Source
var ErrMissingScopeRoot = errors.New("scope root is required")
Functions ¶
func BrowseDir ¶
func BrowseDir(path, scopeRoot string) ([]protocol.BrowseEntry, error)
BrowseDir lists the first default-sized page of entries in the given absolute path. Callers that need additional pages should use BrowseDirPageAt.
func BuildContextRefBlock ¶
func BuildContextRefBlock(root string, refs []protocol.ContextRef, limits ContextRefLimits) string
func MkDir ¶
MkDir creates a directory at the given absolute path. Parent directories are created as needed (like mkdir -p).
Types ¶
type BrowseDirOptions ¶
type BrowseDirPage ¶
type BrowseDirPage struct {
Entries []protocol.BrowseEntry
HasMore bool
NextCursor string
}
func BrowseDirPageAt ¶
func BrowseDirPageAt(path, scopeRoot string, opts BrowseDirOptions) (BrowseDirPage, error)
BrowseDirPageAt lists one bounded page of entries in the given absolute path.
type ContextRefLimits ¶
func DefaultContextRefLimits ¶
func DefaultContextRefLimits() ContextRefLimits
Click to show internal directories.
Click to hide internal directories.