mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #24011 from Alorel/stream-to-promise
add stream-to-promise types
This commit is contained in:
Vendored
+21
@@ -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);
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user