diff --git a/batch-stream/batch-stream-tests.ts b/batch-stream/batch-stream-tests.ts new file mode 100644 index 000000000..2271e67e5 --- /dev/null +++ b/batch-stream/batch-stream-tests.ts @@ -0,0 +1,12 @@ +/// +/// + +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. \ No newline at end of file diff --git a/batch-stream/batch-stream.d.ts b/batch-stream/batch-stream.d.ts new file mode 100644 index 000000000..5aa4889bc --- /dev/null +++ b/batch-stream/batch-stream.d.ts @@ -0,0 +1,24 @@ +// Type definitions for batch-stream 0.1.2 +// Project: https://github.com/segmentio/batch-stream +// Definitions by: Nicholas Penree +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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; +} \ No newline at end of file