Package Exports
- vfile-find-down
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vfile-find-down) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vfile-find-down

Find vfiles by searching the file system downwards.
Installation
npm:
npm install vfile-find-down
Usage
Dependencies:
var findDown = require('vfile-find-down');
Search for files with a .md
extension from the current working
directory downwards:
findDown.all('.md', console.log);
Logs:
null [ VFile {
data: {},
messages: [],
history: [ '/Users/tilde/projects/oss/vfile-find-down/readme.md' ],
cwd: '/Users/tilde/projects/oss/vfile-find-down' } ]
Search for the first file:
findDown.one('.md', console.log);
Logs:
null VFile {
data: {},
messages: [],
history: [ '/Users/tilde/projects/oss/vfile-find-down/readme.md' ],
cwd: '/Users/tilde/projects/oss/vfile-find-down' }
API
vfileFindDown.all(tests[, paths], callback)
Search for tests
downwards. Invokes callback with either an error
or an array of files passing tests
.
Note: Virtual Files are not read (their contents
is not populated).
Parameters
tests
(string|Function|Array.<tests>
) — A test is a function invoked with avfile
. If an array is passed in, any test must match a given file for it to be included. If astring
is passed in, thebasename
orextname
of files must match it for them to be included (and hidden directories andnode_modules
will not be searched).paths
(Array.<string>
orstring
, default:process.cwd()
) — Place(s) to searching from;callback
(function cb(err[, files])
); — Function invoked with all matching files.
vfileFindDown.one(tests[, paths], callback)
Like vfileFindDown.all
, but invokes callback
with the first found
file, or null
.
function test(file, stats)
Check whether a virtual file should be included. Invoked with a vfile and a stats object.
Returns
true
orvfileFindDown.INCLUDE
— Include the file in the results;vfileFindDown.SKIP
— Do not search inside this directory;vfileFindDown.BREAK
— Stop searching for files;- anything else is ignored: files are neither included nor skipped.
The different flags can be combined by using the pipe operator:
vfileFindDown.INCLUDE | vfileFindDown.SKIP
.