Documentation
¶
Overview ¶
Package fsfile is the PURE core of the fs projection: every derivation from a filename or file bytes, with no database and no tile ids. It is shared by the legacy fs plugin and the v2 fs content provider, so the two answer identically BY CONSTRUCTION — the migration parity gate (docs/v2-design.md §8.4) leans on that.
Index ¶
- func Body(dirPath, name string) (data []byte, mediaType string)
- func IsPlainText(name string) bool
- func PageMediaType(name string) string
- func PreviewJPEG(dirPath, name string) []byte
- func PreviewStamp(dirPath, name string) int64
- func ServeFile(stream ServeChunkSender, dirPath, name, subpath string) error
- func ServesPage(name string) bool
- func TextPresentation(name string) string
- type ServeChunkSender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Body ¶
Body returns a file's descent body: real bytes for renderable/plain files under the cap, the metadata summary otherwise. A missing or unstattable file returns (nil, "") — the caller decides what absence means.
func IsPlainText ¶
IsPlainText reports the plain-text classification (TextPresentation's rule, minus the renderable arm).
func PageMediaType ¶
PageMediaType returns the declared page media type for a filename, or "" for names outside the table.
func PreviewJPEG ¶
PreviewJPEG returns a bounded JPEG thumbnail for an image file, or nil for non-images, oversized, and undecodable files — the caller treats nil as "no preview", never an error.
func PreviewStamp ¶
PreviewStamp returns the cheap preview generation for a file — an image's mtime, 0 for everything else (Tile.preview_blob_id on the wire; the client's thumbnail-cache key).
func ServeFile ¶
func ServeFile(stream ServeChunkSender, dirPath, name, subpath string) error
ServeFile streams a file's raw bytes as web content: subpath "" is the named file itself; a non-empty subpath is a page-relative resource resolved against the file's directory, CONFINED to that directory's subtree (the plugin-side guarantee, independent of the door's URL grammar). Absence answers a 404 page, never an error.
func ServesPage ¶
ServesPage marks which of the served types are worth a PAGE DESCENT: what a browser presents natively as a whole document. Subresource types (css, js, json, txt) serve through the door for pages that reference them but keep their text-document descent themselves.
func TextPresentation ¶
TextPresentation classifies a file tile's text-body presentation (decision 2026-08-13): markdown/org render (with the raw-source toggle); the plain-text families show verbatim; everything else has no declaration — the metadata summary renders as it always has.
Types ¶
type ServeChunkSender ¶
type ServeChunkSender interface {
Send(*gridwellv1.ServeContentChunk) error
}
ServeChunkSender is the streaming half both callers provide (the legacy plugin's grpc stream and the v2 adapter's — same chunk type).