Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FTPClientBase

A basic FTP client.

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _DISPOSABLES

_DISPOSABLES: vscode.Disposable[]

Stores disposable sub objects.

Protected _INTERVALS

_INTERVALS: Timer[]

Stores intervals.

Protected _TIMEOUTS

_TIMEOUTS: Timer[]

Stores timeouts.

Protected _connection

_connection: any

Stores the internal connection object / value.

Private _existingRemoteDirs

_existingRemoteDirs: object

Type declaration

  • [path: string]: boolean

isDisposed

isDisposed: boolean

Gets if object has been disposed or not.

isDisposing

isDisposing: boolean

Gets if the 'dispose()' method is currently executed or not.

isInFinalizeState

isInFinalizeState: boolean

Gets if the object is disposed or currently disposing.

options

Gets the underlying options.

values

values: Value[] = []

Stores the list of connection values.

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

connection

  • get connection(): any

isConnected

  • get isConnected(): boolean
  • Gets if the client is currently connected or not.

    Returns boolean

type

  • get type(): string

Methods

addListener

  • addListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

Protected cleanupIntervals

  • cleanupIntervals(): void
  • Cleansup all timeouts.

    Returns void

Protected cleanupTimeouts

  • cleanupTimeouts(): void
  • Cleansup all timeouts.

    Returns void

Abstract connect

  • connect(): Promise<boolean>
  • Connects to the server.

    Returns Promise<boolean>

    The promise that indicates if operation was successful or not.

Protected createDirectoryIfNeeded

  • createDirectoryIfNeeded(dir: string): Promise<boolean>
  • Creates a directory if it does not exist.

    Parameters

    • dir: string

      The directory.

    Returns Promise<boolean>

    The promise that indicates if directory has been created or not.

Protected createParentDirectoryIfNeeded

  • createParentDirectoryIfNeeded(dir: string): Promise<boolean>
  • Creates a parent directory if it does not exist.

    Parameters

    • dir: string

      The child of the directory to check.

    Returns Promise<boolean>

    The promise that indicates if parent directory has been created or not.

Abstract cwd

  • cwd(dir: string): Promise<void>
  • Changes the current directory.

    Parameters

    • dir: string

      The path to the new directory.

    Returns Promise<void>

deleteFile

  • deleteFile(path: string): Promise<boolean>

dispose

  • dispose(): void
  • Dispose this object.

    Returns void

downloadFile

  • downloadFile(path: string): Promise<Buffer>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

Abstract end

  • end(): Promise<boolean>
  • Ends the connections.

    Returns Promise<boolean>

    The promise that indicates if operation was successful or not.

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

Abstract execute

  • execute(cmd: string): Promise<Buffer>
  • Executes a FTP command.

    Parameters

    • cmd: string

      The command to execute.

    Returns Promise<Buffer>

    The promise with the result.

executeCommandsBy

  • executeCommandsBy(provider: function, additionalValues?: Value | Value[]): Promise<Buffer[]>

Abstract get

  • get(file: string): Promise<Buffer>
  • Downloads a file.

    Parameters

    • file: string

      The path of the file.

    Returns Promise<Buffer>

    The promise with the downloaded data.

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Protected getValuesForFile

  • getValuesForFile(file: string): Value[]
  • Returns a list of values for a file.

    Parameters

    • file: string

      The path of the remote file.

    Returns Value[]

    The values.

Abstract list

listDirectory

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

Abstract mkdir

  • mkdir(dir: string): Promise<void>
  • Creates a directory.

    Parameters

    • dir: string

      The path of the directory to create.

    Returns Promise<void>

Protected normalizeValueName

  • normalizeValueName(name: any): string

on

  • on(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

Protected onBeforeUpload

  • onBeforeUpload(path: string, data: Buffer): Promise<Buffer | false>
  • Invokes the event for an 'before upload' operation.

    Parameters

    • path: string

      The path of the remote file.

    • data: Buffer

      The data to upload.

    Returns Promise<Buffer | false>

Protected onDispose

  • onDispose(): void
  • inheritdoc

    Returns void

Protected onUploadCompleted

  • onUploadCompleted(err: any, path: string, data: Buffer, hasBeenUploaded: boolean): Promise<void>
  • Invokes the event for an 'upload completed' operation.

    Parameters

    • err: any

      The error (if occurred).

    • path: string

      The path of the remote file.

    • data: Buffer

      The uploaded data.

    • hasBeenUploaded: boolean

      Indicates if file has been uploaded or not.

    Returns Promise<void>

once

  • once(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

Abstract put

  • put(file: string, data: Buffer): Promise<void>
  • Uploads a file.

    Parameters

    • file: string

      The path to the destination file.

    • data: Buffer

      The data to upload.

    Returns Promise<void>

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeFolder

  • removeFolder(path: string): Promise<boolean>

removeListener

  • removeListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

Abstract rmdir

  • rmdir(path: string): Promise<void>
  • Removes a directory and its sub folders.

    Parameters

    • path: string

    Returns Promise<void>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setValue

  • setValue(name: string, val: any): this
  • Sets a connection value.

    chainable

    Parameters

    • name: string

      The name of the value.

    • val: any

      The value to set.

    Returns this

    this

Abstract unlink

  • unlink(path: string): Promise<void>
  • Deletes a file or folder.

    Parameters

    • path: string

      The path to the thing to delete.

    Returns Promise<void>

uploadFile

  • uploadFile(path: string, data: Buffer): Promise<void>

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc