The interface for a contents manager.

interface IManager {
    fileChanged: ISignal<Contents.IManager, Contents.IChangedArgs>;
    isDisposed: boolean;
    serverSettings: ServerConnection.ISettings;
    addDrive(drive: IDrive): void;
    copy(path: string, toDir: string): Promise<Contents.IModel>;
    createCheckpoint(path: string): Promise<ICheckpointModel>;
    delete(path: string): Promise<void>;
    deleteCheckpoint(path: string, checkpointID: string): Promise<void>;
    dispose(): void;
    driveName(path: string): string;
    get(path: string, options?: IFetchOptions): Promise<Contents.IModel>;
    getDownloadUrl(path: string): Promise<string>;
    getSharedModelFactory(
        path: string,
        options?: IContentProvisionOptions,
    ): null | ISharedFactory;
    listCheckpoints(path: string): Promise<ICheckpointModel[]>;
    localPath(path: string): string;
    newUntitled(options?: Contents.ICreateOptions): Promise<Contents.IModel>;
    normalize(path: string): string;
    rename(path: string, newPath: string): Promise<Contents.IModel>;
    resolvePath(root: string, path: string): string;
    restoreCheckpoint(path: string, checkpointID: string): Promise<void>;
    save(
        path: string,
        options?: Partial<Contents.IModel> & IContentProvisionOptions,
    ): Promise<Contents.IModel>;
}

Hierarchy

Implemented by

Properties

A signal emitted when a file operation takes place.

isDisposed: boolean

Test whether the object has been disposed.

This property is always safe to access.

serverSettings: ServerConnection.ISettings

The server settings associated with the manager.

Methods

  • 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 of the resources held by the object.

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

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

    Returns void

  • 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

      the path.

    Returns string

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

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

    Parameters

    • path: string

      the path.

    Returns string

    The local part of the path.

  • 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

      the path.

    Returns string

    The normalized path.

  • 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

      the path.

    Returns string

    The normalized path.

  • 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.