Merge pull request #30670 from BendingBender/stream-to-string

Add types for stream-to-string
This commit is contained in:
Benjamin Lichtman
2018-11-21 09:58:59 -08:00
committed by GitHub
4 changed files with 56 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for stream-to-string 1.1
// Project: https://github.com/jasonpincin/stream-to-string
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = streamToString;
declare function streamToString(stream: NodeJS.ReadableStream, cb?: Callback): Promise<string>;
declare function streamToString(
stream: NodeJS.ReadableStream,
enc: string,
cb?: Callback
): Promise<string>;
type Callback = (error: Error | undefined, str: string) => void;
@@ -0,0 +1,15 @@
import streamToString = require("stream-to-string");
const stream = (null as any) as NodeJS.ReadableStream;
let convertedString: Promise<string>;
convertedString = streamToString(stream);
convertedString = streamToString(stream, "hex");
streamToString(stream, (err, msg) => {
const e: Error | undefined = err;
const str: string = msg;
});
streamToString(stream, "hex", (err, msg) => {
const e: Error | undefined = err;
const str: string = msg;
});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"stream-to-string-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }