Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Drive

A default implementation for an IDrive, talking to the server using the Jupyter REST API. A namespace for Drive statics.

Hierarchy

  • Drive

Implements

Index

Constructors

constructor

  • Construct a new contents manager object.

    Parameters

    • Default value options: IOptions = {}

      The options used to initialize the object.

    Returns Drive

Properties

Private _apiEndpoint

_apiEndpoint: string

Private _fileChanged

_fileChanged: Signal<this, IChangedArgs> = new Signal<this, Contents.IChangedArgs>(this)

Private _isDisposed

_isDisposed: boolean = false

name

name: string

The name of the drive, which is used at the leading component of file paths.

serverSettings

serverSettings: ISettings

The server settings of the drive.

Accessors

fileChanged

isDisposed

  • get isDisposed(): boolean

Methods

Private _getUrl

  • _getUrl(...args: string[]): string
  • Get a REST url for a file given a path.

    Parameters

    • Rest ...args: string[]

    Returns string

copy

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

    Parameters

    • fromFile: string
    • toDir: string

      The destination directory path.

    Returns Promise<IModel>

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

    Notes

    The server will select the name of the copied file.

    Uses the Jupyter Notebook API and validates the response model.

createCheckpoint

delete

  • delete(localPath: string): Promise<void>

deleteCheckpoint

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

    Parameters

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

    Notes

    Uses the Jupyter Notebook API.

dispose

  • dispose(): void

get

getDownloadUrl

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

    Parameters

    • localPath: string

      An absolute POSIX file path on the server.

      Notes

      It is expected that the path contains no relative paths.

    Returns Promise<string>

listCheckpoints

newUntitled

rename

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

    Parameters

    • oldLocalPath: string

      The original file path.

    • newLocalPath: string

      The new file path.

    Returns Promise<IModel>

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

    Notes

    Uses the Jupyter Notebook API and validates the response model.

restoreCheckpoint

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

    Parameters

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

    Notes

    Uses the Jupyter Notebook API.

save

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

    Parameters

    • localPath: string

      The desired file path.

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

    Notes

    Ensure that model.content is populated for the file.

    Uses the Jupyter Notebook API and validates the response model.

Generated using TypeDoc