Merge pull request #24011 from Alorel/stream-to-promise

add stream-to-promise types
This commit is contained in:
Armando Aguirre
2018-03-07 11:14:10 -08:00
committed by GitHub
4 changed files with 53 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for stream-to-promise 2.2
// Project: https://github.com/bendrucker/stream-to-promise
// Definitions by: Alorel <https://github.com/Alorel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
/**
* Return a promise which resolves when the input stream ends
* @param stream The input stream
* @returns A promise containing the stream output as a buffer
*/
declare function streamToPromise(stream: NodeJS.ReadableStream): Promise<Buffer>;
/**
* Return s promise which resolves when the input stream ends
* @param stream The input stream
*/
declare function streamToPromise(stream: NodeJS.WritableStream): Promise<void>;
export = streamToPromise;
@@ -0,0 +1,8 @@
import stp = require('stream-to-promise');
import * as fs from 'fs';
const read = fs.createReadStream(__filename);
const write = fs.createWriteStream(__filename);
const read$: Promise<Buffer> = stp(read);
const write$: Promise<void> = stp(write);
+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-promise-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }