fs_search.ts

Recursive search of a directory through an fs handle.

Library code over FsReadDir: it takes a handle and reaches nothing else.

view source

Declarations
#

3 declarations

fs_search
#

FsSearchOptions
#

fs_search.ts view source

FsSearchOptions import type {FsSearchOptions} from '@fuzdev/gro/fs_search.js';

path?

The directory to search, relative to the handle. Defaults to the handle's own directory.

type string

id_dir?

The absolute directory each id starts with: an entry's id is id_dir, a /, and the entry's path relative to the searched directory. Defaults to the searched directory's real path, beneath the handle's. A caller that names the directory by another absolute path passes it, so the ids and the filters see the path the caller named.

type string

filter?

Filters each entry must pass, given its absolute id and whether it's a directory. A directory that fails isn't descended into.

type (PathFilter) | (PathFilter)[]

file_filter?

Filters each file must pass, given its absolute id.

type (FileFilter) | (FileFilter)[]

sort?

Whether the results are sorted by path, segment by segment, each compared by code point, the order of its UTF-8 bytes: list's order taken depth-first, so a directory's files come where list puts the directory (a/z.ts before a-b.ts), the same on every machine and runtime; defaults to true. Without sorting the order is volatile.

type boolean

FsSearchResult
#

fs_search.ts view source

FsSearchResult import type {FsSearchResult} from '@fuzdev/gro/fs_search.js';

A file fs_search found: a non-directory entry, with its kind as the listing read it, so a caller that acts on regular files alone can skip a symlink.

inheritance

extends: ResolvedPath

kind

type "file" | "symlink" | "other"

Depends on
#

Imported by
#