Socket
Socket
Sign inDemoInstall

vfile-find-down

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vfile-find-down

vfile utility to find one or more files by searching the file system downwards


Version published
Weekly downloads
547
decreased by-38.4%
Maintainers
1
Weekly downloads
 
Created
Source

vfile-find-down

Build Coverage Downloads Sponsors Backers Chat

Find vfiles by searching the file system downwards.

Install

npm:

npm install vfile-find-down

Use

var findDown = require('vfile-find-down')

findDown.all('.md', console.log)

Yields:

null [ VFile {
  data: {},
  messages: [],
  history: [ '/Users/tilde/projects/oss/vfile-find-down/readme.md' ],
  cwd: '/Users/tilde/projects/oss/vfile-find-down' } ]

API

findDown.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

Things to search for (string|Function|Array.<tests>).

If an array is passed in, any test must match a given file for it to be included.

If a string is passed in, the basename or extname of files must match it for them to be included (and hidden directories and node_modules will not be searched).

Otherwise, they must be function.

paths

Place(s) to searching from (Array.<string> or string, default: process.cwd()).

callback

Function invoked with all matching files (function cb(err[, files])).

findDown.one(tests[, paths], callback)

Like findDown.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 or findDown.INCLUDE — Include the file in the results
  • findDown.SKIP — Do not search inside this directory
  • findDown.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: findDown.INCLUDE | findDown.SKIP.

Contribute

See contributing.md in vfile/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 02 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc