filesystem

package
v0.2.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package filesystem provides an FS abstraction over operating system files overlaid with unsaved editor content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentStore

type DocumentStore interface {
	Get(document.Handle) (*document.Document, error)
	List(document.DirHandle) []*document.Document
}

DocumentStore proves list and get facilities for unsaved documents.

type Filesystem

type Filesystem struct {
	// contains filtered or unexported fields
}

Filesystem provides io/fs.FS compatible two-layer read-only filesystem with preferred source being DocumentStore and native OS FS acting as fallback.

This allows for reading files in a directory while reflecting unsaved changes.

func New

func New(docStore DocumentStore) *Filesystem

New creates an OS filesystem overlaid with the supplied document store.

func (*Filesystem) Open

func (f *Filesystem) Open(name string) (fs.File, error)

Open implements fs.FS.

func (*Filesystem) ReadDir

func (f *Filesystem) ReadDir(dir string) ([]fs.DirEntry, error)

ReadDir provides entries under the supplied directory path.

func (*Filesystem) ReadFile

func (f *Filesystem) ReadFile(name string) ([]byte, error)

ReadFile provides the content at the supplied path.

func (*Filesystem) Stat

func (f *Filesystem) Stat(name string) (os.FileInfo, error)

Stat provides file information at the supplied path.

Jump to

Keyboard shortcuts

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