source: imaps-frontend/node_modules/readdirp/index.d.ts

main
Last change on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[0c6b92a]1import type { Stats, Dirent } from 'fs';
2import { Readable } from 'stream';
3export type Path = string;
4export interface EntryInfo {
5 path: string;
6 fullPath: string;
7 stats?: Stats;
8 dirent?: Dirent;
9 basename: string;
10}
11export type PathOrDirent = Dirent | Path;
12export type Tester = (path: EntryInfo) => boolean;
13export type Predicate = string[] | string | Tester;
14declare function defaultOptions(): {
15 root: string;
16 fileFilter: (_path: EntryInfo) => boolean;
17 directoryFilter: (_path: EntryInfo) => boolean;
18 type: string;
19 lstat: boolean;
20 depth: number;
21 alwaysStat: boolean;
22 highWaterMark: number;
23};
24export type ReaddirpOptions = ReturnType<typeof defaultOptions>;
25export interface DirEntry {
26 files: PathOrDirent[];
27 depth: number;
28 path: Path;
29}
30export declare class ReaddirpStream extends Readable {
31 parents: any[];
32 reading: boolean;
33 parent?: DirEntry;
34 _stat: Function;
35 _maxDepth: number;
36 _wantsDir: boolean;
37 _wantsFile: boolean;
38 _wantsEverything: boolean;
39 _root: Path;
40 _isDirent: boolean;
41 _statsProp: 'dirent' | 'stats';
42 _rdOptions: {
43 encoding: 'utf8';
44 withFileTypes: boolean;
45 };
46 _fileFilter: Tester;
47 _directoryFilter: Tester;
48 constructor(options?: Partial<ReaddirpOptions>);
49 _read(batch: number): Promise<void>;
50 _exploreDir(path: Path, depth: number): Promise<{
51 files: string[] | undefined;
52 depth: number;
53 path: string;
54 }>;
55 _formatEntry(dirent: PathOrDirent, path: Path): Promise<EntryInfo | undefined>;
56 _onError(err: Error): void;
57 _getEntryType(entry: EntryInfo): Promise<void | "" | "file" | "directory">;
58 _includeAsFile(entry: EntryInfo): boolean | undefined;
59}
60/**
61 * Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
62 * @param root Root directory
63 * @param options Options to specify root (start directory), filters and recursion depth
64 */
65export declare const readdirp: (root: Path, options?: Partial<ReaddirpOptions>) => ReaddirpStream;
66export declare const readdirpPromise: (root: Path, options?: Partial<ReaddirpOptions>) => Promise<string[]>;
67export default readdirp;
Note: See TracBrowser for help on using the repository browser.