UNPKG

1.77 kBTypeScriptView Raw
1// Type definitions for glob-stream v6.1.0
2// Project: https://github.com/wearefractal/glob-stream
3// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4// mrmlnc <https://github.com/mrmlnc>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
7/// <reference types="node" />
8/// <reference types="glob" />
9
10import glob = require('glob');
11
12declare function GlobStream(glob: string | string[]): NodeJS.ReadableStream;
13declare function GlobStream(glob: string | string[], options: GlobStream.Options): NodeJS.ReadableStream;
14
15declare namespace GlobStream {
16 export interface Entry {
17 cwd: string;
18 base: string;
19 path: string;
20 }
21
22 export type UniqueByStringPredicate = 'cwd' | 'base' | 'path';
23 export type UniqueByFunctionPredicate = (entry: Entry) => string;
24
25 export interface Options extends glob.IOptions {
26 /**
27 * Whether or not to error upon an empty singular glob.
28 */
29 allowEmpty?: boolean | undefined;
30 /**
31 * The absolute segment of the glob path that isn't a glob. This value is attached
32 * to each globobject and is useful for relative pathing.
33 */
34 base?: string | undefined;
35 /**
36 * Whether or not the `cwd` and `base` should be the same.
37 */
38 cwdbase?: boolean | undefined;
39 /**
40 * Filters stream to remove duplicates based on the string property name or the result of function.
41 * When using a function, the function receives the streamed
42 * data (objects containing `cwd`, `base`, `path` properties) to compare against.
43 */
44 uniqueBy?: UniqueByStringPredicate | UniqueByFunctionPredicate | undefined;
45 }
46}
47
48export = GlobStream;