mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
added defs for some (stream) utils
This commit is contained in:
@@ -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
|
||||
});
|
||||
Vendored
+15
@@ -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;
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
Vendored
+21
@@ -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;
|
||||
}
|
||||
@@ -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');
|
||||
Vendored
+11
@@ -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;
|
||||
}
|
||||
@@ -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) => {
|
||||
|
||||
});
|
||||
Vendored
+6
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Vendored
+23
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user