A Filesystem implementation that stores files on remote hosts via SFTP/SSH.

Hierarchy

Constructors

Properties

baseConfig: {
    baseDir: string;
    ssh: ConnectConfig;
}

Type declaration

  • baseDir: string
  • ssh: ConnectConfig
sshClient?: Client

Methods

  • Using the provided hostConfig, create and cache the SSH connection to the host. If a connection already exists, re-use it.

    Returns Promise<Client>

  • Protected

    Resolve the given store path to an absolute path of a metadata file on the remote filesystem.

    Parameters

    • storePath: string

    Returns string

  • Create the given path on the store as a directory, recursively.

    Parameters

    • args: {
          storePath: string;
      }
      • storePath: string

    Returns Promise<void>

  • Protected

    Normalize the input tags into a single array of strings. This is useful for implementing the fluent interface for putLocalFile().

    Example

    const tags: string[] = this._normalizeTags(args.tag, args.tags)
    

    Parameters

    • Optional tag: string
    • Optional tags: string[]

    Returns string[]

  • Store a file from the local filesystem into the remote filesystem.

    Example

    await store.putLocalFile({
    localPath: '/tmp/temp.file',
    storePath: 'my/upload-key/temp.file',
    mimeType: 'application/json',
    tags: ['json', 'user-data'],
    })

    Parameters

    • args: {
          localPath: string;
          mimeType?: string;
          storePath: string;
          tag?: string;
          tags?: string[];
      }
      • localPath: string
      • Optional mimeType?: string
      • storePath: string
      • Optional tag?: string
      • Optional tags?: string[]

    Returns Promise<void>

  • Remove the given resource(s) from the remote filesystem.

    Parameters

    • args: {
          recursive?: boolean;
          storePath: string;
      }
      • Optional recursive?: boolean
      • storePath: string

    Returns Promise<void>

  • Fetch some information about a file that may or may not be in the remote filesystem without fetching the entire file.

    Parameters

    • args: {
          storePath: string;
      }
      • storePath: string

    Returns Promise<Stat>

  • Protected

    Resolve the given store path to an absolute path on the remote filesystem.

    Parameters

    • storePath: string

    Returns string

  • Protected

    Given a readable stream, cast it to a string.

    Parameters

    • stream: ReadableStream

    Returns Promise<string>

  • If the file does not exist in the remote filesystem, create it. If it does exist, update the modify timestamps.

    Parameters

    • args: {
          storePath: string;
      }
      • storePath: string

    Returns Promise<void>