Expand description
Filesystem helpers shared by the ecosystem crawlers.
Each crawler walks one or more package directories and decides whether each entry is a candidate package. The two operations that all eight crawlers repeat are:
- listing entries in a directory while tolerating permission / I/O errors (we treat an unreadable directory as “no entries”);
- asking whether an entry is a directory while tolerating
file_type()failures (we treat a stat error as “not a dir”).
Centralizing both keeps each crawler free of the
match read_dir { Ok(rd) => rd, Err(_) => return … } boilerplate
and gives integration tests a single function to drive when they
want to exercise the read_dir Err arm via chmod 000.
Both helpers are async because the rest of the crawler code is —
they delegate to tokio::fs.
§Symlinks
entry_is_dir follows symlinks (uses metadata(), not
symlink_metadata()), matching the historical behavior of the
crawlers (pnpm’s content-addressed store relies on resolving
symlinks into node_modules/.pnpm/*).
Functions§
- entry_
file_ type - Return the raw
FileTypeforentry, swallowing stat errors. - entry_
is_ dir - Resolve whether
entryis a directory, following symlinks. - list_
dir_ entries - List the immediate children of
path.