import * as ssh2 from "ssh2"; export = sftp; type FileInfoType = "d" | "-" | "l"; declare class sftp { constructor(name?: string); connect(options: sftp.ConnectOptions): Promise; list(remoteFilePath: string, filter?: sftp.ListFilterFunction): Promise; exists(remotePath: string): Promise; stat(remotePath: string): Promise; realPath(remotePath: string): Promise; get( path: string, dst?: string | NodeJS.WritableStream, options?: sftp.TransferOptions, ): Promise; fastGet(remoteFilePath: string, localPath: string, options?: sftp.FastGetTransferOptions): Promise; put( input: string | Buffer | NodeJS.ReadableStream, remoteFilePath: string, options?: sftp.TransferOptions, ): Promise; fastPut(localPath: string, remoteFilePath: string, options?: sftp.FastPutTransferOptions): Promise; cwd(): Promise; mkdir(remoteFilePath: string, recursive?: boolean): Promise; rmdir(remoteFilePath: string, recursive?: boolean): Promise; delete(remoteFilePath: string, noErrorOK?: boolean): Promise; rename(remoteSourcePath: string, remoteDestPath: string): Promise; chmod(remotePath: string, mode: number | string): Promise; append( input: Buffer | NodeJS.ReadableStream, remotePath: string, options?: sftp.WriteStreamOptions, ): Promise; uploadDir(srcDir: string, destDir: string, options?: sftp.UploadDirOptions): Promise; downloadDir(srcDir: string, destDir: string, options?: sftp.DownloadDirOptions): Promise; end(): Promise; on(event: string, callback: (...args: any[]) => void): void; removeListener(event: string, callback: (...args: any[]) => void): void; posixRename(fromPath: string, toPath: string): Promise; rcopy(srcPath: string, dstPath: string): Promise; createReadStream(remotePath: string, options?: ssh2.ReadStreamOptions): ssh2.ReadStream; createWriteStream(remotePath: string, options?: ssh2.WriteStreamOptions): ssh2.WriteStream; } declare namespace sftp { interface ConnectOptions extends ssh2.ConnectConfig { retries?: number; retry_factor?: number; retry_minTimeout?: number; } interface ModeOption { mode?: number | string; } interface PipeOptions { /** * @deprecated this option is ignored in v9.x. raw stream operations should use {@link createReadStream} or {@link createWriteStream} instead */ end?: boolean; } interface ReadStreamOptions extends ModeOption { flags?: "r"; encoding?: null | string; handle?: null | string; /** * @deprecated this option is ignored in v9.x. raw stream operations should use {@link createReadStream} instead */ autoClose?: boolean; } interface WriteStreamOptions extends ModeOption { flags?: "w" | "a"; encoding?: null | string; /** * @deprecated this option is ignored in v9.x. raw stream operations should use {@link createWriteStream} instead */ autoClose?: boolean; } interface TransferOptions { pipeOptions?: PipeOptions; writeStreamOptions?: WriteStreamOptions; readStreamOptions?: ReadStreamOptions; } interface FastGetTransferOptions { concurrency?: number; chunkSize?: number; step?: (totalTransferred: number, chunk: number, total: number) => void; } interface FastPutTransferOptions extends FastGetTransferOptions, ModeOption {} interface FileInfo { type: FileInfoType; name: string; size: number; modifyTime: number; accessTime: number; rights: { user: string; group: string; other: string; }; owner: number; group: number; } interface FileStats { mode: number; uid: number; gid: number; size: number; accessTime: number; modifyTime: number; isDirectory: boolean; isFile: boolean; isBlockDevice: boolean; isCharacterDevice: boolean; isSymbolicLink: boolean; isFIFO: boolean; isSocket: boolean; } type ListFilterFunction = (fileInfo: FileInfo) => boolean; type DirFilterFunction = (filePath: string, isDirectory: boolean) => boolean; interface DirOptions { filter?: DirFilterFunction; } interface UploadDirOptions extends DirOptions { useFastput?: boolean; } interface DownloadDirOptions extends DirOptions { useFastget?: boolean; } }