diff --git a/types/stream-to-promise/index.d.ts b/types/stream-to-promise/index.d.ts new file mode 100644 index 0000000000..ee9688ffda --- /dev/null +++ b/types/stream-to-promise/index.d.ts @@ -0,0 +1,21 @@ +// 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; + +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..6ed2ee7b71 --- /dev/null +++ b/types/stream-to-promise/stream-to-promise-tests.ts @@ -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 = 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" }