Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IManager

The interface for a contents manager.

Hierarchy

  • IDisposable
    • IManager

Implemented by

Index

Properties

Readonly fileChanged

fileChanged: ISignal<IManager, IChangedArgs>

A signal emitted when a file operation takes place.

Readonly isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

Readonly serverSettings

serverSettings: ISettings

The server settings associated with the manager.

Methods

addDrive

  • addDrive(drive: IDrive): void
  • Add an IDrive to the manager.

    Parameters

    Returns void

copy

  • copy(path: string, toDir: string): Promise<IModel>
  • Copy a file into a given directory.

    Parameters

    • path: string

      The original file path.

    • toDir: string

      The destination directory path.

    Returns Promise<IModel>

    A promise which resolves with the new content model when the file is copied.

createCheckpoint

  • Create a checkpoint for a file.

    Parameters

    • path: string

      The path of the file.

    Returns Promise<ICheckpointModel>

    A promise which resolves with the new checkpoint model when the checkpoint is created.

delete

  • delete(path: string): Promise<void>
  • Delete a file.

    Parameters

    • path: string

      The path to the file.

    Returns Promise<void>

    A promise which resolves when the file is deleted.

deleteCheckpoint

  • deleteCheckpoint(path: string, checkpointID: string): Promise<void>
  • Delete a checkpoint for a file.

    Parameters

    • path: string

      The path of the file.

    • checkpointID: string

      The id of the checkpoint to delete.

    Returns Promise<void>

    A promise which resolves when the checkpoint is deleted.

dispose

  • dispose(): void
  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

driveName

  • driveName(path: string): string
  • Given a path of the form drive:local/portion/of/it.txt get the name of the drive. If the path is missing a drive portion, returns an empty string.

    Parameters

    • path: string

    Returns string

    The drive name for the path, or the empty string.

get

  • Get a file or directory.

    Parameters

    Returns Promise<IModel>

    A promise which resolves with the file content.

getDownloadUrl

  • getDownloadUrl(path: string): Promise<string>
  • Get an encoded download url given a file path.

    Parameters

    • path: string

    Returns Promise<string>

getModelDBFactory

  • getModelDBFactory(path: string): IFactory
  • Given a path, get a ModelDB.IFactory from the relevant backend. Returns null if the backend does not provide one.

    Parameters

    • path: string

    Returns IFactory

listCheckpoints

  • List available checkpoints for a file.

    Parameters

    • path: string

      The path of the file.

    Returns Promise<ICheckpointModel[]>

    A promise which resolves with a list of checkpoint models for the file.

localPath

  • localPath(path: string): string
  • Given a path of the form drive:local/portion/of/it.txt get the local part of it.

    Parameters

    • path: string

    Returns string

    The local part of the path.

newUntitled

  • Create a new untitled file or directory in the specified directory path.

    Parameters

    Returns Promise<IModel>

    A promise which resolves with the created file content when the file is created.

normalize

  • normalize(path: string): string
  • Normalize a global path. Reduces '..' and '.' parts, and removes leading slashes from the local part of the path, while retaining the drive name if it exists.

    Parameters

    • path: string

    Returns string

    The normalized path.

rename

  • rename(path: string, newPath: string): Promise<IModel>
  • Rename a file or directory.

    Parameters

    • path: string

      The original file path.

    • newPath: string

      The new file path.

    Returns Promise<IModel>

    A promise which resolves with the new file content model when the file is renamed.

resolvePath

  • resolvePath(root: string, path: string): string
  • Resolve a global path, starting from the root path. Behaves like posix-path.resolve, with 3 differences:

    • will never prepend cwd
    • if root has a drive name, the result is prefixed with ":"
    • before adding drive name, leading slashes are removed

    Parameters

    • root: string
    • path: string

    Returns string

    The normalized path.

restoreCheckpoint

  • restoreCheckpoint(path: string, checkpointID: string): Promise<void>
  • Restore a file to a known checkpoint state.

    Parameters

    • path: string

      The path of the file.

    • checkpointID: string

      The id of the checkpoint to restore.

    Returns Promise<void>

    A promise which resolves when the checkpoint is restored.

save

  • save(path: string, options?: Partial<IModel>): Promise<IModel>
  • Save a file.

    Parameters

    • path: string

      The desired file path.

    • Optional options: Partial<IModel>

      Optional overrides to the model.

    Returns Promise<IModel>

    A promise which resolves with the file content model when the file is saved.

Generated using TypeDoc