UNPKG

nest-sftp

Version:

Nest Framework wrapper around ssh2-sftp-client

22 lines (21 loc) 1.27 kB
import { ConnectConfig } from 'ssh2'; import * as SftpClient from 'ssh2-sftp-client'; export declare class SftpClientService { private readonly sftpClient; private readonly logger; constructor(sftpClient: SftpClient); client(): SftpClient; resetConnection(config: ConnectConfig): Promise<void>; disconnect(): Promise<void>; stat(remotePath: string): Promise<SftpClient.FileStats>; realPath(remotePath: string): Promise<string>; upload(contents: string | Buffer | NodeJS.ReadableStream, remoteFilePath: string, transferOptions?: SftpClient.TransferOptions): Promise<string>; list(remoteDirectory: string, pattern?: string | RegExp): Promise<SftpClient.FileInfo[]>; download(path: string, dst?: string | NodeJS.WritableStream, options?: SftpClient.TransferOptions): Promise<string | NodeJS.WritableStream | Buffer>; delete(remoteFilePath: string): Promise<void>; makeDirectory(remoteFilePath: string, recursive?: boolean): Promise<void>; removeDirectory(remoteFilePath: string, recursive?: boolean): Promise<void>; rename(remoteSourcePath: string, remoteDestinationPath: string): Promise<void>; exists(remotePath: string): Promise<false | 'd' | '-' | 'l'>; connect(config: ConnectConfig): Promise<void>; }