fsfile

package
v0.0.0-...-03f2bdc Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 14 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Body

func Body(dirPath, name string) (data []byte, mediaType string)

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

func IsPlainText(name string) bool

IsPlainText reports the plain-text classification (TextPresentation's rule, minus the renderable arm).

func PageMediaType

func PageMediaType(name string) string

PageMediaType returns the declared page media type for a filename, or "" for names outside the table.

func PreviewJPEG

func PreviewJPEG(dirPath, name string) []byte

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

func PreviewStamp(dirPath, name string) int64

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

func ServesPage(name string) bool

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

func TextPresentation(name string) string

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).

Jump to

Keyboard shortcuts

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