mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Add definitions for concat-stream (#13851)
This commit is contained in:
20
concat-stream/concat-stream-tests.ts
Normal file
20
concat-stream/concat-stream-tests.ts
Normal 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
17
concat-stream/index.d.ts
vendored
Normal 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;
|
||||
20
concat-stream/tsconfig.json
Normal file
20
concat-stream/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
concat-stream/tslint.json
Normal file
1
concat-stream/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user