mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-14 22:10:30 +00:00
Merge pull request #30670 from BendingBender/stream-to-string
Add types for stream-to-string
This commit is contained in:
Vendored
+17
@@ -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;
|
||||
});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user