🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

findup-sync

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

findup-sync

Find the first file matching a given pattern in the current directory or the nearest ancestor directory.

latest
Source
npmnpm
Version
5.0.0
Version published
Maintainers
5
Created
Source

findup-sync

NPM version Downloads Build Status Coveralls Status

Find the first file matching a given pattern in the current directory or the nearest ancestor directory.

Matching is done with micromatch, please report any matching related issues on that repository.

Usage

var findup = require('findup-sync');
findup(patternOrPatterns [, micromatchOptions]);

// Start looking in the CWD.
var filepath1 = findup('{a,b}*.txt');

// Start looking somewhere else, and ignore case (probably a good idea).
var filepath2 = findup('{a,b}*.txt', {cwd: '/some/path', nocase: true});

API

findup(patterns, [options])

  • patterns {String|Array}: Glob pattern(s) or file path(s) to match against.
  • options {Object}: Options to pass to micromatch. Note that if you want to start in a different directory than the current working directory, specify a cwd property here.
  • returns {String}: Returns the first matching file.

License

MIT

Keywords

file

FAQs

Package last updated on 31 Oct 2021

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