find-down
Find a file by walking down parent directories.
Last updated 3 years ago by sholladay .
MPL-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install find-down 
SYNC missed versions from official npm registry.

find-down Build status for find-down on Circle CI.

Find a file by walking down parent directories.

Why?

  • Find files high up in the filesystem quickly.
  • Good at finding things that are probably in $HOME.
  • Is to find-up what indexOf is to lastIndexOf.

Install

npm install find-down --save

Usage

Get it into your program.

const findDown = require('find-down');

Find the topmost file with the given name.

findDown('unicorn.png').then((filepath) => {
    console.log(filepath);  // => '/Users/sholladay/unicorn.png'
});

API

findDown(filename, option)

Returns a Promise for either the filepath or null if it cannot be found.

findDown([filenameA, filenameB], option)

Returns a Promise for either the first filepath found (by respecting the order) or null if none could be found.

filename

Type: string

Filename of the file to find.

option

cwd

Type: string
Default: process.cwd()

Directory to end with.

Contributing

See our contributing guidelines for more details.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

MPL-2.0 © Seth Holladay

Go make something, dang it.

Current Tags

  • 0.1.4                                ...           latest (3 years ago)

5 Versions

  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 5
Dependencies (2)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |