[ssh2-sftp-client] Update for release 4.1 (latest) (#38415)

This commit is contained in:
Taylor Herron
2019-09-17 13:43:20 -04:00
committed by Orta
parent e6b219b686
commit 9140de406d
2 changed files with 23 additions and 6 deletions
+19 -6
View File
@@ -1,10 +1,11 @@
// Type definitions for ssh2-sftp-client 2.5
// Project: https://github.com/jyu213/ssh2-sftp-client
// Type definitions for ssh2-sftp-client 4.1
// Project: https://github.com/theophilusx/ssh2-sftp-client
// Definitions by: igrayson <https://github.com/igrayson>
// Ascari Andrea <https://github.com/ascariandrea>
// Kartik Malik <https://github.com/kartik2406>
// Michael Pertl <https://github.com/viamuli>
// Orblazer <https://github.com/orblazer>
// Taylor Herron <https://github.com/gbhmt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as ssh2 from 'ssh2';
@@ -17,10 +18,12 @@ declare class sftp {
list(remoteFilePath: string): Promise<sftp.FileInfo[]>;
exists(remotePath: string): Promise<boolean>;
exists(remotePath: string): Promise<false | "d" | "-" | "l">;
stat(remotePath: string): Promise<sftp.FileStats>;
realPath(remotePath: string): Promise<string>;
get(path: string, dst?: string | NodeJS.ReadableStream, options?: boolean): Promise<string | NodeJS.ReadableStream | Buffer>;
fastGet(remoteFilePath: string, localPath: string, options?: ssh2Stream.TransferOptions): Promise<string>;
@@ -29,6 +32,8 @@ declare class sftp {
fastPut(localPath: string, remoteFilePath: string, options?: ssh2Stream.TransferOptions): Promise<string>;
cwd(): Promise<string>;
mkdir(remoteFilePath: string, recursive?: boolean): Promise<string>;
rmdir(remoteFilePath: string, recursive?: boolean): Promise<string>;
@@ -44,6 +49,8 @@ declare class sftp {
end(): Promise<void>;
on(event: string, callback: (...args: any[]) => void): void;
removeListener(event: string, callback: (...args: any[]) => void): void;
}
declare namespace sftp {
@@ -64,11 +71,17 @@ declare namespace sftp {
interface FileStats {
mode: number;
permissions?: any;
owner: number;
group: 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;
}
}
@@ -16,6 +16,8 @@ client.exists('/remote/path').then(() => null);
client.stat('/remote/path').then(() => null);
client.realPath('/remote/path').then(() => null);
client.get('/remote/path').then(() => null);
client.fastGet('/remote/path', 'local/path').then(() => null);
@@ -26,6 +28,8 @@ client.put(fs.createReadStream('Hello World'), '/remote/path').then(() => null);
client.fastPut('/remote/path', 'local/path').then(() => null);
client.cwd().then(() => null);
client.mkdir('/remote/path/dir', true).then(() => null);
client.rmdir('/remote/path/dir', true).then(() => null);