From e5472a24cf3f71113bd3043aa383c4c3941ec3cb Mon Sep 17 00:00:00 2001 From: Arturas Molcanovas Date: Thu, 1 Mar 2018 22:29:57 +0000 Subject: [PATCH 1/3] add stream-to-promise pkg Signed-off-by: Arturas Molcanovas --- types/stream-to-promise/index.d.ts | 23 +++++++++++++++++++ .../stream-to-promise-tests.ts | 8 +++++++ types/stream-to-promise/tsconfig.json | 23 +++++++++++++++++++ types/stream-to-promise/tslint.json | 1 + 4 files changed, 55 insertions(+) create mode 100644 types/stream-to-promise/index.d.ts create mode 100644 types/stream-to-promise/stream-to-promise-tests.ts create mode 100644 types/stream-to-promise/tsconfig.json create mode 100644 types/stream-to-promise/tslint.json diff --git a/types/stream-to-promise/index.d.ts b/types/stream-to-promise/index.d.ts new file mode 100644 index 0000000000..09ca3a5ca3 --- /dev/null +++ b/types/stream-to-promise/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for stream-to-promise 2.2 +// Project: https://github.com/bendrucker/stream-to-promise +// Definitions by: Alorel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * 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; + +/** + * Return s promise which resolves when the input stream ends + * @param stream The input stream + */ +declare function streamToPromise(stream: NodeJS.WritableStream): Promise; + +declare namespace streamToPromise {} // Add a namespace so we can do import * instead of import x = require() + +export = streamToPromise; diff --git a/types/stream-to-promise/stream-to-promise-tests.ts b/types/stream-to-promise/stream-to-promise-tests.ts new file mode 100644 index 0000000000..95ce74b3aa --- /dev/null +++ b/types/stream-to-promise/stream-to-promise-tests.ts @@ -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 = stp(read); +const write$: Promise = stp(write); diff --git a/types/stream-to-promise/tsconfig.json b/types/stream-to-promise/tsconfig.json new file mode 100644 index 0000000000..c8a17b114c --- /dev/null +++ b/types/stream-to-promise/tsconfig.json @@ -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" + ] +} diff --git a/types/stream-to-promise/tslint.json b/types/stream-to-promise/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/stream-to-promise/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6a11051b079a464a2e13209494794d7af507c5e1 Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 7 Mar 2018 09:14:16 +0000 Subject: [PATCH 2/3] Update index.d.ts --- types/stream-to-promise/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/stream-to-promise/index.d.ts b/types/stream-to-promise/index.d.ts index 09ca3a5ca3..ee9688ffda 100644 --- a/types/stream-to-promise/index.d.ts +++ b/types/stream-to-promise/index.d.ts @@ -18,6 +18,4 @@ declare function streamToPromise(stream: NodeJS.ReadableStream): Promise */ declare function streamToPromise(stream: NodeJS.WritableStream): Promise; -declare namespace streamToPromise {} // Add a namespace so we can do import * instead of import x = require() - export = streamToPromise; From da58e5fa9612eead8cf2999666db5b55efbdb23b Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 7 Mar 2018 09:14:41 +0000 Subject: [PATCH 3/3] Update stream-to-promise-tests.ts --- types/stream-to-promise/stream-to-promise-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/stream-to-promise/stream-to-promise-tests.ts b/types/stream-to-promise/stream-to-promise-tests.ts index 95ce74b3aa..6ed2ee7b71 100644 --- a/types/stream-to-promise/stream-to-promise-tests.ts +++ b/types/stream-to-promise/stream-to-promise-tests.ts @@ -1,4 +1,4 @@ -import * as stp from 'stream-to-promise'; +import stp = require('stream-to-promise'); import * as fs from 'fs'; const read = fs.createReadStream(__filename);