Merge pull request #4995 from drudge/master

Add `batch-stream` definitions
This commit is contained in:
Horiuchi_H
2015-07-21 12:30:35 +09:00
2 changed files with 36 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="batch-stream.d.ts" />
import fs = require('fs');
import BatchStream = require('batch-stream');
var batch = new BatchStream({ size : 5 });
var stream = fs.createReadStream('/etc/passwd');
stream
.pipe(batch)
.pipe(fs.createWriteStream('./test.out')); // deals with array input from pipe.
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for batch-stream 0.1.2
// Project: https://github.com/segmentio/batch-stream
// Definitions by: Nicholas Penree <http://github.com/drudge>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "batch-stream" {
import stream = require('stream');
interface Options {
size?: number;
highWaterMark?: number;
}
class BatchStream extends stream.Transform {
size: number;
batch: any[];
constructor(options: Options);
}
export = BatchStream;
}