index.d.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /// <reference types="node" />
  2. import { EventEmitter } from 'events';
  3. import { SFTPWrapper } from 'ssh2';
  4. import { Stats } from 'ssh2-streams';
  5. export interface IScpOptions {
  6. host?: string;
  7. port?: number;
  8. username?: string;
  9. password?: string;
  10. privateKey?: Buffer | string;
  11. passphrase?: string;
  12. forceIPv4?: boolean;
  13. forceIPv6?: boolean;
  14. readyTimeout?: number;
  15. keepaliveInterval?: number;
  16. keepaliveCountMax?: number;
  17. remoteOsType?: 'posix' | 'win32';
  18. }
  19. export declare class ScpClient extends EventEmitter {
  20. sftpWrapper: SFTPWrapper | null;
  21. private sshClient;
  22. remotePathSep: string;
  23. endCalled: boolean;
  24. errorHandled: boolean;
  25. constructor(options: IScpOptions);
  26. uploadFile(localPath: string, remotePath: string): Promise<void>;
  27. downloadFile(remotePath: string, localPath: string): Promise<void>;
  28. emptyDir(dir: string): Promise<void>;
  29. uploadDir(src: string, dest: string): Promise<void>;
  30. downloadDir(remotePath: string, localPath: string): Promise<string>;
  31. stat(remotePath: string): Promise<Stats>;
  32. unlink(remotePath: string): Promise<void>;
  33. _rmdir(remotePath: string): Promise<void>;
  34. rmdir(remotePath: string): Promise<void>;
  35. mkdir(remotePath: string): Promise<void>;
  36. exists(remotePath: string): Promise<string | boolean>;
  37. close(): void;
  38. list(remotePath: string, pattern?: RegExp): Promise<any>;
  39. realPath(remotePath: string): Promise<string>;
  40. }
  41. export declare function Client(options: IScpOptions): Promise<ScpClient>;
  42. export default Client;