Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · embed

Docs

std/embed

On this page

Index

Types

Dir

struct Dir {
  files: Map[Str, Bytes]
}

Files embedded at build time, keyed by their slash path relative to the directory of the file that declares the constant.

Source: std/embed.xo:9

Dir.read

fn (d: Dir) read(path: Str) -> Bytes?

The bytes of the file at path, or None.

Source: std/embed.xo:14

Dir.read_text

fn (d: Dir) read_text(path: Str) -> Str?

The text of the file at path, or None when there is none or it is not valid UTF-8.

Source: std/embed.xo:17

Dir.contains

fn (d: Dir) contains(path: Str) -> Bool

Whether there is a file at path.

Source: std/embed.xo:19

Dir.paths

fn (d: Dir) paths() -> List[Str]

Every file’s path, sorted.

Source: std/embed.xo:21

Dir.sub

fn (d: Dir) sub(dir: Str) -> Dir

The files under directory dir, keyed relative to it.

Source: std/embed.xo:23

Dir.len

fn (d: Dir) len() -> Int

The number of files.

Source: std/embed.xo:25

Dir.fs

fn (d: Dir) fs() -> Fs

A read-only Fs over the files (decision 0304), for code written against Fs: read, read_text, stat, exists, read_dir, walk, glob, mode, and sub see the files and the directories their paths imply (a path is relative, /, . and a leading ./ name the root); every write, open, and lock is FsErr.Denied. Nothing needs a capability.

Source: std/embed.xo:31

↑ index