Include missing type for the method readFile

This commit is contained in:
Lucas Motta
2018-11-28 16:16:54 +00:00
parent 53d58bb442
commit 793d709fb2
2 changed files with 44 additions and 0 deletions
+24
View File
@@ -1,6 +1,7 @@
// Type definitions for ssh2-streams v0.1.9
// Project: https://github.com/mscdex/ssh2-streams
// Definitions by: Ron Buckton <https://github.com/rbuckton>
// Definitions by: Ron Buckton <https://github.com/lucasmotta>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -1044,6 +1045,24 @@ export class SFTPStream extends stream.Transform {
*/
fastPut(localPath: string, remotePath: string, callback: (err: any) => void): void;
/**
* (Client-only)
* Reads a file in memory and returns its contents
*/
readFile(remotePath: string, options: ReadFileOptions, callback: (err: any, handle: Buffer) => void): void;
/**
* (Client-only)
* Reads a file in memory and returns its contents
*/
readFile(remotePath: string, encoding: string, callback: (err: any, handle: Buffer) => void): void;
/**
* (Client-only)
* Reads a file in memory and returns its contents
*/
readFile(remotePath: string, callback: (err: any, handle: Buffer) => void): void;
/**
* (Client-only)
* Returns a new readable stream for `path`.
@@ -1612,6 +1631,11 @@ export interface TransferOptions {
step?: (total_transferred: number, chunk: number, total: number) => void;
}
export interface ReadFileOptions {
encoding?: string
flag?: string
}
export interface ReadStreamOptions {
flags?: string;
encoding?: string;
+20
View File
@@ -3,6 +3,7 @@
// Definitions by: Qubo <https://github.com/tkQubo>
// Ron Buckton <https://github.com/rbuckton>
// Will Boyce <https://github.com/wrboyce>
// Lucas Motta <https://github.com/lucasmotta>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -21,6 +22,7 @@ import {
Attributes,
Stats,
TransferOptions,
ReadFileOptions,
ReadStreamOptions,
WriteStreamOptions,
FileEntry
@@ -1273,6 +1275,24 @@ export interface SFTPWrapper extends events.EventEmitter {
*/
fastPut(localPath: string, remotePath: string, callback: (err: any) => void): void;
/**
* (Client-only)
* Reads a file in memory and returns its contents
*/
readFile(remotePath: string, options: ReadFileOptions, callback: (err: any, handle: Buffer) => void): void;
/**
* (Client-only)
* Reads a file in memory and returns its contents
*/
readFile(remotePath: string, encoding: string, callback: (err: any, handle: Buffer) => void): void;
/**
* (Client-only)
* Reads a file in memory and returns its contents
*/
readFile(remotePath: string, callback: (err: any, handle: Buffer) => void): void;
/**
* (Client-only)
* Returns a new readable stream for `path`.