UNPKG

2.99 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/glob-stream`
3
4# Summary
5This package contains type definitions for glob-stream (https://github.com/wearefractal/glob-stream).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/glob-stream.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/glob-stream/index.d.ts)
10````ts
11/// <reference types="node" />
12
13import { PicomatchOptions } from "picomatch";
14import { Readable } from "streamx";
15
16declare function globStream(glob: string | string[]): Readable<globStream.Entry>;
17declare function globStream(glob: string | string[], options: globStream.Options): Readable<globStream.Entry>;
18
19declare namespace globStream {
20 export interface Entry {
21 cwd: string;
22 base: string;
23 path: string;
24 }
25
26 export type UniqueByStringPredicate = keyof Entry;
27 export type UniqueByFunctionPredicate = (entry: Entry) => string;
28
29 // Here, the settings interface provided by `picomatch` is used rather than the `anymatch` one's.
30 // This is due to the fact that `anymatch` redirects its options to `picomatch`.
31 // Furthermore, `anymatch`s type declaration of the `picomatch` options is hand-written and describes some of the available options incorrectly.
32 export interface Options extends PicomatchOptions {
33 /**
34 * Whether or not to error upon an empty singular glob.
35 */
36 allowEmpty?: boolean | undefined;
37 /**
38 * The current working directory that the glob is resolved against.
39 */
40 cwd?: string | undefined;
41 /**
42 * The root path that the glob is resolved against.
43 */
44 root?: string | undefined;
45 /**
46 * The absolute segment of the glob path that isn't a glob. This value is attached
47 * to each glob object and is useful for relative pathing.
48 */
49 base?: string | undefined;
50 /**
51 * Whether or not the {@linkcode cwd} and {@linkcode base} should be the same.
52 */
53 cwdbase?: boolean | undefined;
54 /**
55 * Filters stream to remove duplicates based on the string property name or the result of function.
56 * When using a function, the function receives the streamed
57 * data (objects containing `cwd`, `base`, `path` properties) to compare against.
58 */
59 uniqueBy?: UniqueByStringPredicate | UniqueByFunctionPredicate | undefined;
60 }
61}
62
63export = globStream;
64
65````
66
67### Additional Details
68 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
69 * Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/picomatch](https://npmjs.com/package/@types/picomatch), [@types/streamx](https://npmjs.com/package/@types/streamx)
70
71# Credits
72These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [mrmlnc](https://github.com/mrmlnc), and [Manuel Thalmann](https://github.com/manuth).
73
\No newline at end of file