| 18 | } |
| 19 | |
| 20 | interface Sftp { |
| 21 | /** |
| 22 | * Executes command on ssh-server |
| 23 | * @param command |
| 24 | * @param onSucess |
| 25 | * @param onFail |
| 26 | */ |
| 27 | exec(command: String, onSucess: (res: ExecResult)=>void, onFail: (err: any) => void): void; |
| 28 | /** |
| 29 | * Connects to SFTP server |
| 30 | * @param host Hostname of the server |
| 31 | * @param port port numer |
| 32 | * @param username Username |
| 33 | * @param password Password or private key file to authenticate the server |
| 34 | * @param onSuccess Callback function on success returns url of copied file/dir |
| 35 | * @param onFail Callback function on error returns error object |
| 36 | */ |
| 37 | connectUsingPassoword(host: String, port: Number, username: String, password: String, onSuccess: () => void, onFail: (err: any) => void): void; |
| 38 | |
| 39 | /** |
| 40 | * Connects to SFTP server |
| 41 | * @param host Hostname of the server |
| 42 | * @param port port numer |
| 43 | * @param username Username |
| 44 | * @param keyFile Password or private key file to authenticate the server |
| 45 | * @param passphrase Passphrase for keyfile |
| 46 | * @param onSuccess Callback function on success returns url of copied file/dir |
| 47 | * @param onFail Callback function on error returns error object |
| 48 | */ |
| 49 | connectUsingKeyFile(host: String, port: Number, username: String, keyFile: String, passphrase: String, onSuccess: () => void, onFail: (err: any) => void): void; |
| 50 | |
| 51 | /** |
| 52 | * Gets file from the server. |
| 53 | * @param filename |
| 54 | * @param localFilename copy/shadow of remote file. |
| 55 | * @param onSuccess |
| 56 | * @param onFail |
| 57 | */ |
| 58 | getFile(filename: String, localFilename: String, onSuccess: (url: String) => void, onFail: (err: any) => void): void; |
| 59 | |
| 60 | /** |
| 61 | * Uploaded the file to server |
| 62 | * @param filename |
| 63 | * @param localFilename copy/shadow of remote file. |
| 64 | * @param onSuccess |
| 65 | * @param onFail |
| 66 | */ |
| 67 | putFile(filename: String, localFilename: String, onSuccess: (url: String) => void, onFail: (err: any) => void): void; |
| 68 | |
| 69 | /** |
| 70 | * Closes the connection |
| 71 | * @param onSuccess |
| 72 | * @param onFail |
| 73 | */ |
| 74 | close(onSuccess: () => void, onFail: (err: any) => void): void; |
| 75 | |
| 76 | /** |
| 77 | * Gets wether server is connected or not. |
no outgoing calls
no test coverage detected