diff --git a/concat-stream/concat-stream-tests.ts b/concat-stream/concat-stream-tests.ts new file mode 100644 index 0000000000..6dac3129f0 --- /dev/null +++ b/concat-stream/concat-stream-tests.ts @@ -0,0 +1,20 @@ +import concat = require("concat-stream") + +import { Readable } from "stream"; + +class MyReadable extends Readable { + i: number = 1; + _read() { + if (this.i <= 100) { + this.push(this.i.toString()); + this.i++; + } else { + this.push(null); + } + } +} + +let myReadable = new MyReadable(); + +myReadable.pipe(concat((buf) => console.log(buf.toString()))); +myReadable.pipe(concat({}, (buf) => console.log(buf.toString()))); diff --git a/concat-stream/index.d.ts b/concat-stream/index.d.ts new file mode 100644 index 0000000000..578a3e48b8 --- /dev/null +++ b/concat-stream/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for concat-stream 1.6 +// Project: https://github.com/maxogden/concat-stream +// Definitions by: Joey Marianer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Writable } from "stream"; + +interface ConcatOpts { + encoding?: string; +} + +declare function concat(cb: (buf: Buffer) => void): Writable; +declare function concat(opts: ConcatOpts, cb: (buf: Buffer) => void): Writable; + +export = concat; diff --git a/concat-stream/tsconfig.json b/concat-stream/tsconfig.json new file mode 100644 index 0000000000..3e6c0e2260 --- /dev/null +++ b/concat-stream/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "concat-stream-tests.ts" + ] +} diff --git a/concat-stream/tslint.json b/concat-stream/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/concat-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }