Options
All
  • Public
  • Public/Protected
  • All
Menu

The AFileSystem constructor takes a single argument, which represents an initial filesystem content.

Every Object (not subclasses, but literal objects) represent a directory, while every array holds the versions of a logical file.

Versions are specified on lookup by appending @version to the path. No version specified is the same as @latest, which obtains the highest numbered version (the last in the array). You can ignore named versions (labels), or even multiple versions, but files are always identified by being in an array.

A file can be any value, but normally they will be either an FileAttachment or an AFile; they implement the same interface.

The actual file is not returned, but rather an AFileAwait. This is a proxy with the same methods, but the methods return undefined if the file specified is not found.

Hierarchy

  • AFileSystem

Implements

Index

Constructors

constructor

  • new AFileSystem(tree: Tree, options?: { name?: string; readOnly?: boolean }): AFileSystem
  • Parameters

    • tree: Tree

      The specification of what directories and files to initialize the filesystem with

    • options: { name?: string; readOnly?: boolean } = ...

      Optional options: readOnly and name

      • Optional name?: string
      • Optional readOnly?: boolean

    Returns AFileSystem

Properties

[Symbol.toStringTag]

[Symbol.toStringTag]: "AFileSystem"

Preserve the class name across minification.

errored

errored: (e: Error) => void

Type declaration

    • (e: Error): void
    • Parameters

      • e: Error

      Returns void

name

name: string

readOnly

readOnly: boolean

subscription

subscription: AsyncGenerator<AFileSystem, any, unknown>

tree

tree: Tree

updateCount

updateCount: number

updated

updated: (n: AFileSystem) => void

Type declaration

Methods

add

  • add(path: string, file: VFile): any
  • Add a new file at the specified path. If no version, or 'latest', adds a new version. Otherwise sets the specified version or label.

    Parameters

    Returns any

    the file

copy

  • copy(from: string, to: string): any
  • Copy file from to. If 'latest' or unspecified, copies only the latest.

    Parameters

    • from: string

      Path to the existing file

    • to: string

      Path to the destination

    Returns any

    the file copied

find

  • find(path: string): any
  • Find the file at the given (possibly versioned) path.

    Parameters

    • path: string

      the full pathname to the desired file

    Returns any

    An AFileAwait

label

  • label(path: string, label: string): any
  • Label the version at the specified path with 'label'. A label selects a specific version of a file; it is not a property of a file version.

    Parameters

    • path: string

      Path to the file

    • label: string

      Label to add to the file

    Returns any

    The file labeled.

metadata

  • metadata(path: string): Promise<null | Metadata>
  • Return the metadata for the requested path. Metadata can be associated with either a specific version, or the entire collection of versions at a path. The results are merged.

    Parameters

    • path: string

      Path to the file

    Returns Promise<null | Metadata>

    Promise yielding Metadata or null if the file is not found.

waitFor

  • waitFor(path: string): AsyncGenerator<any, void, unknown>
  • Wait for the requested path. The return value is an async generator that yields when the requested path is available.

    Parameters

    • path: string

      Path to the file

    Returns AsyncGenerator<any, void, unknown>

    An async generator yielding a value for the file when it becomes available..

watch

  • watch(path: string, nullOK?: boolean): AsyncGenerator<any, void, unknown>
  • Wait for the requested path. The return value is an async generator that yields once for each value stored at path.

    Parameters

    • path: string

      Path to the file

    • nullOK: boolean = false

      if true, null will be returned by the generator whenever the file does not exist; by default it is filtered out.

    Returns AsyncGenerator<any, void, unknown>

    An async generator yielding values for a file as it changes (new versions created/deleted).

Generated using TypeDoc