Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PolyOut

PolyOut, mysteriously named for historical reasons, allows Features to store data on a virtual file system not accessible to other Features.

The API is loosely modelled after a subset of Node.js' fsPromises, with some polyPod specific functionality on top.

Instead of POSIX paths, PolyOut deals with IDs - platform-specific, unambiguous references to files and directories. On some platforms, these may be POSIX paths, but it could also be URLs or file handles. Manipulating IDs directly is therefore discouraged.

see

PolyIn for access to the polyPod's internal triplestore, which is the recommended way of storing most data.

Hierarchy

  • PolyOut

Index

Methods

  • importArchive(url: string, destId?: string): Promise<string>
  • Imports an archive stored outside the polyPod into the Feature's virtual file system.

    Parameters

    • url: string

      The URL of the archive to import.

    • Optional destId: string

      The desired destination ID the imported archive's contents in the virtual file system. Will be generated if not specified.

    Returns Promise<string>

    The ID of the imported archive's contents - same as destId if specified.

  • readDir(id: string): Promise<Entry[]>
  • Reads the directory at the given ID recursively and returns all entries.

    Parameters

    • id: string

      The ID of the directory to read.

    Returns Promise<Entry[]>

    A list of all entries within the supplied directory.

  • readFile(id: string): Promise<Uint8Array>
  • Reads the file with the given id.

    Parameters

    • id: string

      The ID of the file to read.

    Returns Promise<Uint8Array>

    The contents of the file.

  • removeArchive(id: string): Promise<void>
  • Removes a previously imported archive.

    Parameters

    • id: string

      The ID of the archive to be removed.

    Returns Promise<void>

    A promise that resolves to a value of type void.

  • stat(id: string): Promise<Stats>
  • Returns information about a file or directory.

    Parameters

    • id: string

      The ID of the file or directory to analyze.

    Returns Promise<Stats>

    Information about the file or directory.

  • writeFile(id: string, content: string): Promise<void>
  • Writes the supplied content to the file at id.

    Parameters

    • id: string

      The ID of the file to write to.

    • content: string

      The content to write to the file.

    Returns Promise<void>

Generated using TypeDoc