vfile-find-down is a utility for the vfile ecosystem, designed to locate one or multiple files by recursively searching the file system downwards from a given path. It processes files into `VFile` objects but does not populate their content, suggesting the use of `to-vfile` for actual file reading. Currently at version 7.1.0, the package maintains an active release cadence, with major versions introducing significant changes like the move to ESM and stricter Node.js requirements. It serves as a complementary tool to `vfile-find-up`, which handles upward directory traversal, making it suitable for scenarios like finding all Markdown files within a project directory rather than configuration files in parent directories.
npm install vfile-find-downVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `findDown` to locate the first Markdown file in the current directory or its subdirectories and how to optionally read its content using `to-vfile`.
Ensure your Node.js environment is version 16 or higher. Update Node.js if necessary.
Migrate your import statements from `const pkg = require('pkg')` to `import { pkg } from 'pkg'`.Update your code to use the new function names: `findDown` for finding the first file, and `findDownAll` for finding all files.
If you are using the callback API, update your logic to expect and return an object like `{ break: true, include: true }` instead of symbol combinations.Avoid using undocumented or private APIs. Only use the officially exported identifiers like `findDown` and `findDownAll`.
If you need to access the file's content, use `to-vfile` (e.g., `toVFile.read(vfile)`) after finding the `VFile`.
Update your import statement to use ES module syntax: `import { findDown } from 'vfile-find-down';` and ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).If you intended to find all files, change your call to `findDownAll`. If you intended to find a single file and were using `findDownOne`, you can now use `findDown`.
Ensure you pass a valid string or array of strings (or `URL` objects) as the `paths` argument, specifying where to start the search. By default, it uses `process.cwd()` if omitted, but explicit undefined might cause issues.