Ignore:
Timestamp:
01/21/25 03:08:24 (3 days ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
0c6b92a
Message:

F4 Finalna Verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/readdirp/index.d.ts

    r0c6b92a r79a0317  
    1 import type { Stats, Dirent } from 'fs';
    2 import { Readable } from 'stream';
     1/**
     2 * Recursive version of readdir. Exposes a streaming API and promise API.
     3 * Streaming API allows to use a small amount of RAM.
     4 *
     5 * @module
     6 * @example
     7```js
     8import readdirp from 'readdirp';
     9for await (const entry of readdirp('.')) {
     10  const {path} = entry;
     11  console.log(`${JSON.stringify({path})}`);
     12}
     13```
     14 */
     15/*! readdirp - MIT License (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) */
     16import type { Stats, Dirent } from 'node:fs';
     17import { Readable } from 'node:stream';
     18/** Path in file system. */
    319export type Path = string;
     20/** Emitted entry. Contains relative & absolute path, basename, and either stats or dirent. */
    421export interface EntryInfo {
    522    path: string;
     
    926    basename: string;
    1027}
     28/** Path or dir entries (files) */
    1129export type PathOrDirent = Dirent | Path;
    12 export type Tester = (path: EntryInfo) => boolean;
     30/** Filterer for files */
     31export type Tester = (entryInfo: EntryInfo) => boolean;
    1332export type Predicate = string[] | string | Tester;
    14 declare function defaultOptions(): {
     33export declare const EntryTypes: {
     34    readonly FILE_TYPE: "files";
     35    readonly DIR_TYPE: "directories";
     36    readonly FILE_DIR_TYPE: "files_directories";
     37    readonly EVERYTHING_TYPE: "all";
     38};
     39export type EntryType = (typeof EntryTypes)[keyof typeof EntryTypes];
     40/**
     41 * Options for readdirp.
     42 * * type: files, directories, or both
     43 * * lstat: whether to use symlink-friendly stat
     44 * * depth: max depth
     45 * * alwaysStat: whether to use stat (more resources) or dirent
     46 * * highWaterMark: streaming param, specifies max amount of resources per entry
     47 */
     48export type ReaddirpOptions = {
    1549    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;
     50    fileFilter?: Predicate;
     51    directoryFilter?: Predicate;
     52    type?: EntryType;
     53    lstat?: boolean;
     54    depth?: number;
     55    alwaysStat?: boolean;
     56    highWaterMark?: number;
    2357};
    24 export type ReaddirpOptions = ReturnType<typeof defaultOptions>;
     58/** Directory entry. Contains path, depth count, and files. */
    2559export interface DirEntry {
    2660    files: PathOrDirent[];
     
    2862    path: Path;
    2963}
     64/** Readable readdir stream, emitting new files as they're being listed. */
    3065export declare class ReaddirpStream extends Readable {
    3166    parents: any[];
     
    5590    _formatEntry(dirent: PathOrDirent, path: Path): Promise<EntryInfo | undefined>;
    5691    _onError(err: Error): void;
    57     _getEntryType(entry: EntryInfo): Promise<void | "" | "file" | "directory">;
     92    _getEntryType(entry: EntryInfo): Promise<void | '' | 'file' | 'directory'>;
    5893    _includeAsFile(entry: EntryInfo): boolean | undefined;
    5994}
    6095/**
    61  * Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
     96 * Streaming version: Reads all files and directories in given root recursively.
     97 * Consumes ~constant small amount of RAM.
    6298 * @param root Root directory
    6399 * @param options Options to specify root (start directory), filters and recursion depth
    64100 */
    65 export declare const readdirp: (root: Path, options?: Partial<ReaddirpOptions>) => ReaddirpStream;
    66 export declare const readdirpPromise: (root: Path, options?: Partial<ReaddirpOptions>) => Promise<string[]>;
     101export declare function readdirp(root: Path, options?: Partial<ReaddirpOptions>): ReaddirpStream;
     102/**
     103 * Promise version: Reads all files and directories in given root recursively.
     104 * Compared to streaming version, will consume a lot of RAM e.g. when 1 million files are listed.
     105 * @returns array of paths and their entry infos
     106 */
     107export declare function readdirpPromise(root: Path, options?: Partial<ReaddirpOptions>): Promise<EntryInfo[]>;
    67108export default readdirp;
Note: See TracChangeset for help on using the changeset viewer.