Add definitions for concat-stream (#13851)

This commit is contained in:
Joey Marianer
2017-01-09 07:11:57 -08:00
committed by Andy
parent d3ae5ced6d
commit 8d3b3fbdc4
4 changed files with 58 additions and 0 deletions

View File

@@ -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())));

17
concat-stream/index.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for concat-stream 1.6
// Project: https://github.com/maxogden/concat-stream
// Definitions by: Joey Marianer <https://github.com/jmarianer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
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;

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }