mirror of https://github.com/jkjoy/sunpeiwen.git
86 lines
2.0 KiB
TypeScript
86 lines
2.0 KiB
TypeScript
import { Client } from 'ssh2';
|
|
import { QueuifiedSFTP } from './queuifiedSftp';
|
|
import { SftpSyncConfig, SftpSyncOptions } from './config';
|
|
/**
|
|
* Creates a new SftpDeploy instance
|
|
* @class
|
|
*/
|
|
export declare class SftpSync {
|
|
/**
|
|
* Config object
|
|
*/
|
|
config: SftpSyncConfig;
|
|
/**
|
|
* Options object
|
|
*/
|
|
options: SftpSyncOptions;
|
|
/**
|
|
* SSH2 Client
|
|
*/
|
|
client: Client;
|
|
/**
|
|
* Promisified SFTP wrapper with queue
|
|
*/
|
|
queuifiedSftp: QueuifiedSFTP;
|
|
/**
|
|
* Local directory root
|
|
*/
|
|
localRoot: string;
|
|
/**
|
|
* Remote directory root
|
|
*/
|
|
remoteRoot: string;
|
|
/**
|
|
* Whether a SSH2 connection has been made or not
|
|
*/
|
|
private connected;
|
|
/**
|
|
* Constructor
|
|
*/
|
|
constructor(config: SftpSyncConfig, options?: SftpSyncOptions);
|
|
/**
|
|
* Make SSH2 connection
|
|
*/
|
|
connect(): Promise<void>;
|
|
/**
|
|
* Close SSH2 connection
|
|
*/
|
|
close(): void;
|
|
/**
|
|
* Sync with specified path
|
|
*/
|
|
sync(relativePath?: string, isRootTask?: boolean): Promise<void>;
|
|
/**
|
|
* Upload file/directory
|
|
*/
|
|
upload(relativePath: string, isRootTask?: boolean): Promise<void>;
|
|
/**
|
|
* Remove a remote file or directory
|
|
*/
|
|
removeRemote(relativePath: string, isRootTask?: boolean): Promise<void>;
|
|
/**
|
|
* No operation
|
|
*/
|
|
noop(): Promise<void>;
|
|
/**
|
|
* Create a directory on a remote host
|
|
*/
|
|
createRemoteDirectory(relativePath: string): Promise<void>;
|
|
/**
|
|
* Build a local and remote files status report for the specified path
|
|
*/
|
|
private buildSyncTable(relativePath);
|
|
/**
|
|
* Get an async version of sftp stream
|
|
*/
|
|
private initQueuifiedSftp(concurrency?);
|
|
/**
|
|
* Get a full path of a local file or directory
|
|
*/
|
|
private localFullPath(relativePath);
|
|
/**
|
|
* Get a full path of a remote file or directory
|
|
*/
|
|
private remoteFullPath(relativePath);
|
|
}
|