Socket
Socket
Sign inDemoInstall

vfile-find-up

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vfile-find-up

Find files by searching the file system upwards


Version published
Weekly downloads
26K
decreased by-20.67%
Maintainers
1
Weekly downloads
 
Created
Source

vfile-find-up Build Status Coverage Status

Find vfiles by searching the file system upwards.

Installation

npm:

npm install vfile-find-up

Usage

var findUp = require('vfile-find-up')

findUp.all('package.json', console.log)

Yields:

null [ VFile {
  data: {},
  messages: [],
  history: [ '/Users/tilde/projects/oss/vfile-find-up/package.json' ],
  cwd: '/Users/tilde/projects/oss/vfile-find-up' } ]

API

findUp.all(tests[, path], callback)

Search for tests upwards. 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 a string is passed in, the basename or extname of files must match it for them to be included.

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

Otherwise, they must be function.

path

Place to searching from (string, default: process.cwd()).

callback

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

findUp.one(tests[, path], callback)

Like findUp.all, but invokes callback with the first found file, or null.

function test(file)

Check whether a virtual file should be included. Invoked with a vfile.

Returns
  • true or findUp.INCLUDE — Include the file in the results;
  • findUp.BREAK — Stop searching for files;
  • anything else is ignored: the file is not included.

The different flags can be combined by using the pipe operator: findUp.INCLUDE | findUp.BREAK.

Contribute

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

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 05 May 2018

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