mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
add stream-to-promise pkg
Signed-off-by: Arturas Molcanovas <a.molcanovas@gmail.com>
This commit is contained in:
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// 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>;
|
||||
|
||||
declare namespace streamToPromise {} // Add a namespace so we can do import * instead of import x = require()
|
||||
|
||||
export = streamToPromise;
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as stp from '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