Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Drive

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

Hierarchy

  • Drive

Implements

Index

Constructors

constructor

  • Construct a new contents manager object.

    Parameters

    • Optional options: IOptions

      The options used to initialize the object.

    Returns Drive

Properties

Private _apiEndpoint

_apiEndpoint: any

Private _fileChanged

_fileChanged: any

Private _getUrl

_getUrl: any

Get a REST url for a file given a path.

Private _isDisposed

_isDisposed: any

Readonly name

name: string

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

Readonly serverSettings

serverSettings: ISettings

The server settings of the drive.

Accessors

fileChanged

  • A signal emitted when a file operation takes place.

    Returns ISignal<this, IChangedArgs>

isDisposed

  • get isDisposed(): boolean
  • Test whether the manager has been disposed.

    Returns boolean

Methods

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

  • Create a checkpoint for a file.

    Parameters

    • localPath: string

      The path of the file.

    Returns Promise<ICheckpointModel>

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

    Notes

    Uses the Jupyter Notebook API and validates the response model.

delete

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

    Parameters

    • localPath: string

      The path to the file.

    Returns Promise<void>

    A promise which resolves when the file is deleted.

    Notes

    Uses the Jupyter Notebook API.

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

    Returns void

get

  • Get a file or directory.

    Parameters

    Returns Promise<IModel>

    A promise which resolves with the file content.

    Uses the Jupyter Notebook API and validates the response model.

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.

      The returned URL may include a query parameter.

    Returns Promise<string>

listCheckpoints

  • List available checkpoints for a file.

    Parameters

    • localPath: string

      The path of the file.

    Returns Promise<ICheckpointModel[]>

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

    Notes

    Uses the Jupyter Notebook API and validates the response model.

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.

    Notes

    Uses the Jupyter Notebook API and validates the response model.

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.

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

    Notes

    Ensure that model.content is populated for the file.

    Uses the Jupyter Notebook API and validates the response model.

Generated using TypeDoc