files#

Interfaces#

FileKind#

Defined in: editor/src/files.ts:17

What a picker offers: a description and the extensions it filters on, by media type.

Properties#

accept#

readonly accept: object

Defined in: editor/src/files.ts:19

Index Signature#

[mediaType: string]: readonly string[]

description#

readonly description: string

Defined in: editor/src/files.ts:18


FileReader#

Defined in: editor/src/files.ts:365

What a server needs to read a file by its path from the root.

Methods#

readFile()#

readFile(path): Promise<Blob>

Defined in: editor/src/files.ts:366

Parameters#
path#

string

Returns#

Promise<Blob>


Opened#

Defined in: editor/src/files.ts:115

A file the browser handed over, with the handle to write back to when it gave one.

Properties#

file#

readonly file: File

Defined in: editor/src/files.ts:117

handle#

readonly handle: FileSystemFileHandle | null

Defined in: editor/src/files.ts:118

name#

readonly name: string

Defined in: editor/src/files.ts:116


OpenedText#

Defined in: editor/src/files.ts:185

A file the browser handed over, read as text.

Properties#

handle#

readonly handle: FileSystemFileHandle | null

Defined in: editor/src/files.ts:188

name#

readonly name: string

Defined in: editor/src/files.ts:186

text#

readonly text: string

Defined in: editor/src/files.ts:187


Saved#

Defined in: editor/src/files.ts:122

Where a text was saved.

Properties#

handle#

readonly handle: FileSystemFileHandle | null

Defined in: editor/src/files.ts:124

name#

readonly name: string

Defined in: editor/src/files.ts:123

Variables#

ANONYMOUS_BUNDLE#

const ANONYMOUS_BUNDLE: "bundle" = "bundle"

Defined in: editor/src/files.ts:403

The file name of a manifest that has neither an id nor a name, before its extension: every manifest is an alignment bundle, and this one an anonymous bundle.


MANIFEST_FILE#

const MANIFEST_FILE: FileKind

Defined in: editor/src/files.ts:43

A manifest file to import: canonical YAML (.yaml, .yml) or JSON (.json), read by its content.


MATCH_CLAIM_TABLE#

const MATCH_CLAIM_TABLE: FileKind

Defined in: editor/src/files.ts:52

A MatchClaim table, the Parquet file a package holds its MatchClaims in (match_claims.parquet), read through the server.


OPENABLE_FILE#

const OPENABLE_FILE: FileKind

Defined in: editor/src/files.ts:69

What Open… offers: a workspace, manifest files (imported, as Import manifest… imports them) and the MatchClaim tables beside either.


UNTITLED#

const UNTITLED: string

Defined in: editor/src/files.ts:112

The name a new workspace is saved under: its default name’s file, untitled.tle.json.


WORKSPACE_FILE#

const WORKSPACE_FILE: FileKind

Defined in: editor/src/files.ts:25

A workspace file: JSON, extension .tle.json.

Functions#

baseName()#

baseName(path): string

Defined in: editor/src/files.ts:347

The last segment of path: the file’s name.

Parameters#

path#

string

Returns#

string


folderOf()#

folderOf(path): string

Defined in: editor/src/files.ts:341

The folder of the file path (a path from the root): "" for a file in the root.

Parameters#

path#

string

Returns#

string


isMatchClaimTable()#

isMatchClaimTable(name): boolean

Defined in: editor/src/files.ts:84

Whether the file named name is a MatchClaim table to the pickers: its extension is .parquet.

Parameters#

name#

string

Returns#

boolean


isWorkspaceFile()#

isWorkspaceFile(name): boolean

Defined in: editor/src/files.ts:79

Whether the file named name is a workspace file to Open…: its extension is .tle.json.

Parameters#

name#

string

Returns#

boolean


lastChanged()#

lastChanged(journal): string | null

Defined in: editor/src/files.ts:421

When a journal was last changed, as local YYYY-MM-DD HH:MM; null for an empty journal.

Parameters#

journal#

readonly Entry[]

Returns#

string | null


manifestFileKind()#

manifestFileKind(serialization): FileKind

Defined in: editor/src/files.ts:89

The file a manifest is exported to in serialization: .yaml for YAML, .json for both JSON forms.

Parameters#

serialization#

Serialization

Returns#

FileKind


manifestFileName()#

manifestFileName(manifest, serialization): string

Defined in: editor/src/files.ts:411

The file name a manifest is exported under in serialization: its id, else its name, else bundle, each character outside A–Z a–z 0–9 _ - written _, then the extension of the serialization’s file: .yaml for YAML, .json for both JSON forms.

Parameters#

manifest#

Manifest

serialization#

Serialization

Returns#

string


openFile()#

openFile(kind): Promise<OpenedText | null>

Defined in: editor/src/files.ts:192

Let the viewer pick one file of kind and read it as text; null when they cancel.

Parameters#

kind#

FileKind

Returns#

Promise<OpenedText | null>


openFiles()#

openFiles(kind, multiple?): Promise<Opened[]>

Defined in: editor/src/files.ts:163

Let the viewer pick files of kind, one or, with multiple, several at once; none when they cancel.

Parameters#

kind#

FileKind

multiple?#

boolean = false

Returns#

Promise<Opened[]>


permitted()#

permitted(handle, access): Promise<boolean>

Defined in: editor/src/files.ts:233

Whether the browser lets the page use handle for access, asking the user where it must (a handle kept from an earlier visit; the browser asks only while the user’s last key or click is recent). A browser without the permission calls lets every handle it gave be used; one that cannot ask now refuses.

Parameters#

handle#

FileSystemHandle

access#

Access

Returns#

Promise<boolean>


relativePath()#

relativePath(folder, path): string

Defined in: editor/src/files.ts:356

The path of the file path relative to the folder folder, both from the root: .. for every folder left, then the rest of path (relativePath("work", "story/a.yaml") is ../story/a.yaml).

Parameters#

folder#

string

path#

string

Returns#

string


resolvedPath()#

resolvedPath(folder, path): string | null

Defined in: editor/src/files.ts:336

The path from the server’s root of path, relative to the folder folder (a path from the root, "" the root); null where it leads above the root or is no relative location (isRelativeLocation).

Parameters#

folder#

string

path#

string

Returns#

string | null


saveFile()#

saveFile(text, kind, name, handle?): Promise<Saved | null>

Defined in: editor/src/files.ts:261

Save text (a text, or the bytes of a Blob): into handle when given and the browser lets the page write there (permitted), else to a file the viewer picks, offered as name (Save as). Without the pickers it is downloaded as name. null when the viewer cancels.

Parameters#

text#

string | Blob

kind#

FileKind

name#

string

handle?#

FileSystemFileHandle | null = null

Returns#

Promise<Saved | null>


savesByDownload()#

savesByDownload(): boolean

Defined in: editor/src/files.ts:304

Whether a save without a server downloads the file: the browser has no save picker.

Returns#

boolean


serverSource()#

serverSource(server, folder): object

Defined in: editor/src/files.ts:379

The files a manifest in the server’s folder folder names: read(url) reads the location url relative to that folder through server (readFile); null where the server holds no file there (it answers 404) or the location leads out of the root or is a URL. Rejects when the server fails otherwise.

Parameters#

server#

FileReader

folder#

string

Returns#

object

read()#

read(url): Promise<Blob | null>

Parameters#
url#

string

Returns#

Promise<Blob | null>


withMatchClaimTable()#

withMatchClaimTable(kind): FileKind

Defined in: editor/src/files.ts:58

kind with the MatchClaim table offered beside it, for pickers that take both at once.

Parameters#

kind#

FileKind

Returns#

FileKind


workspaceFileName()#

workspaceFileName(name): string

Defined in: editor/src/files.ts:106

The default file name of a workspace named name: <name>.tle.json, every character a file name cannot hold replaced by _.

Parameters#

name#

string

Returns#

string