import Client from 'ssh2-sftp-client'; export interface SftpClientConfig { host: string; port?: number; username?: string; password?: string; privateKey?: string; } export interface SyncToS3Response { s3uri: string; etag?: string; } export interface ListItem { name: string; path: string; type: string; size: number; time: number; } export declare type ListResponse = ListItem[]; export declare class SftpClient { private readonly sftpClient; private connected; private readonly clientOptions; constructor(config: SftpClientConfig); connect(): Promise; end(): Promise; get sftp(): Client; /** * build remote url * * @param {string} remotePath - the full path to the remote file to be fetched * @returns {string} - remote url * @private */ buildRemoteUrl(remotePath: string): string; /** * Download a remote file to disk * * @param {string} remotePath - the full path to the remote file to be fetched * @param {string} localPath - the full local destination file path * @param {boolean} fastDownload - whether fast download is performed using parallel reads * @returns {Promise} - the local path that the file was saved to */ download(remotePath: string, localPath: string, fastDownload?: boolean): Promise; unlink(remotePath: string): Promise; /** * Transfer the remote file to a given s3 location * * @param {string} remotePath - the full path to the remote file to be fetched * @param {string} bucket - destination s3 bucket of the file * @param {string} key - destination s3 key of the file * @returns {Promise.<{ s3uri: string, etag: string }>} an object containing * the S3 URI and ETag of the destination file */ syncToS3(remotePath: string, bucket: string, key: string): Promise; logProgress(total_transferred: number, chunk: number, total: number): void; /** * Transfer the remote file to a given s3 location. * Download is performed using parallel reads for faster throughput. * Lambda ephemeral storage is used to download files before files are uploaded to s3 * * @param {string} remotePath - the full path to the remote file to be fetched * @param {string} bucket - destination s3 bucket of the file * @param {string} key - destination s3 key of the file * @returns {Promise.<{ s3uri: string, etag: string }>} an object containing * the S3 URI and ETag of the destination file */ syncToS3Fast(remotePath: string, bucket: string, key: string): Promise; /** * List file in remote path * * @param {string} remotePath - the remote path to be listed * @returns {Promise} list of file objects */ list(remotePath: string): Promise; /** * Transfer an s3 file to remote path * * @param {Object} s3object * @param {string} s3object.Bucket - S3 bucket * @param {string} s3object.Key - S3 object key * @param {string} remotePath - the full remote destination file path * @returns {Promise} */ syncFromS3(s3object: { Bucket: string; Key: string; }, remotePath: string): Promise; } export default SftpClient; //# sourceMappingURL=index.d.ts.map