diff --git a/types/ssh2-sftp-client/index.d.ts b/types/ssh2-sftp-client/index.d.ts index d36869329b..2d8c4409e1 100644 --- a/types/ssh2-sftp-client/index.d.ts +++ b/types/ssh2-sftp-client/index.d.ts @@ -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 // Ascari Andrea // Kartik Malik // Michael Pertl // Orblazer +// Taylor Herron // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as ssh2 from 'ssh2'; @@ -17,10 +18,12 @@ declare class sftp { list(remoteFilePath: string): Promise; - exists(remotePath: string): Promise; + exists(remotePath: string): Promise; stat(remotePath: string): Promise; + realPath(remotePath: string): Promise; + get(path: string, dst?: string | NodeJS.ReadableStream, options?: boolean): Promise; fastGet(remoteFilePath: string, localPath: string, options?: ssh2Stream.TransferOptions): Promise; @@ -29,6 +32,8 @@ declare class sftp { fastPut(localPath: string, remoteFilePath: string, options?: ssh2Stream.TransferOptions): Promise; + cwd(): Promise; + mkdir(remoteFilePath: string, recursive?: boolean): Promise; rmdir(remoteFilePath: string, recursive?: boolean): Promise; @@ -44,6 +49,8 @@ declare class sftp { end(): Promise; 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; } } diff --git a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts index 2c3d12d2f6..44fe403bce 100644 --- a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts +++ b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts @@ -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);