added defs for some (stream) utils

This commit is contained in:
Bart van der Schoor
2014-05-26 14:31:30 +02:00
parent 568cb00761
commit cc82b36997
10 changed files with 163 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
/// <reference path="./findup-sync.d.ts" />
/// <reference path="../node/node.d.ts" />
import findup = require('findup-sync');
var str: string;
str = findup('foo');
str = findup(['foo', 'bar']);
str = findup('foo', {
debug: true
});
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for findup-sync v0.1.3
// Project: https://github.com/cowboy/node-findup-sync
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../minimatch/minimatch.d.ts" />
declare module 'findup-sync' {
import minimatch = require('minimatch');
function mod(pattern: string, opts?: minimatch.IOptions): string;
function mod(pattern: string[], opts?: minimatch.IOptions): string;
export = mod;
}
+12
View File
@@ -0,0 +1,12 @@
/// <reference path="./from.d.ts" />
/// <reference path="../node/node.d.ts" />
import from = require('from');
var rs: NodeJS.ReadableStream;
rs = from([]);
rs = from(function (count: number, next: () => any) {
this.emit('end');
});
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for from v0.1.3
// Project: https://github.com/dominictarr/from
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'from' {
var mod: mod.From;
module mod {
interface From {
(getChunk: (count: number, next: () => any) => any): NodeJS.ReadableStream;
(chunks: any[]): NodeJS.ReadableStream;
emit(type: string, data: any): void;
}
}
export = mod;
}
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="./readdir-stream.d.ts" />
/// <reference path="../node/node.d.ts" />
import readdir = require('readdir-stream');
var rs: NodeJS.ReadableStream;
rs = readdir('foo');
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for readdir-stream v0.1.0
// Project: https://github.com/logicalparadox/readdir-stream
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'readdir-stream' {
function readdir(dir: string): NodeJS.ReadableStream;
export = readdir;
}
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="./stream-to-array.d.ts" />
/// <reference path="../node/node.d.ts" />
import toArray = require('stream-to-array');
var rs: NodeJS.ReadableStream;
toArray(rs, (err, arr) => {
});
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="../node/node.d.ts" />
declare module 'stream-to-array' {
function toArray(stream: NodeJS.ReadableStream, callback: (err: any, arr: any[]) => void): NodeJS.ReadWriteStream;
export = toArray;
}
+44
View File
@@ -0,0 +1,44 @@
/// <reference path="./through2.d.ts" />
/// <reference path="../node/node.d.ts" />
import through2 = require('through2');
var rws: NodeJS.ReadWriteStream;
rws = through2({
objectMode: true,
allowHalfOpen: true
}, function (entry: any, enc: string, callback: () => void) {
this.push('foo');
callback();
}, () => {
});
rws = through2(function (entry: any, enc: string, callback: () => void) {
this.push('foo');
callback();
}, () => {
});
rws = through2(function (entry: any, enc: string, callback: () => void) {
this.push('foo');
callback();
});
rws = through2();
// obj
rws = through2.obj(function (entry: any, enc: string, callback: () => void) {
this.push('foo');
callback();
}, () => {
});
rws = through2.obj(function (entry: any, enc: string, callback: () => void) {
this.push('foo');
callback();
});
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for through2 v 0.4.2
// Project: https://github.com/rvagg/through2
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'through2' {
import stream = require('stream');
var mod: mod.Through2;
module mod {
interface Through2 {
(transform?: (entry: any, enc: string, callback: () => void) => void, flush?: () => void): NodeJS.ReadWriteStream;
(opts: stream.DuplexOptions, transform?: (entry: any, enc: string, callback: () => void) => void, flush?: () => void): NodeJS.ReadWriteStream;
obj(transform: (entry: any, enc: string, callback: () => void) => void, flush?: () => void): NodeJS.ReadWriteStream;
push(data: any): void;
}
}
export = mod;
}