# find-down

> Find a file by walking down parent directories.

Latest version **0.1.4** (published 2017-10-26) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install find-down
pnpm add find-down
yarn add find-down
bun add find-down
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2017-10-26 |
| First published | 2016-08-11 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | separate (@types/find-down) |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Seth Holladay |
| Maintainers | sholladay |
| Keywords | find, down, find-down, finddown, look-down, look, file, files, search, match, package, resolve, parent, parents, folder, directory, directories, dir, dirs, walk, walking, path, paths |

## Links

- npm: https://www.npmjs.com/package/find-down
- Repository: https://github.com/sholladay/find-down
- Issues: https://github.com/sholladay/find-down/issues
- npm.io page: https://npm.io/package/find-down

## Dependencies (2)

- [next-path](https://npm.io/package/next-path.md) ^1.0.0
- [locate-path](https://npm.io/package/locate-path.md) ^2.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.4 (latest) — 2017-10-26
- 0.1.3 — 2017-08-15
- 0.1.2 — 2016-08-12
- 0.1.1 — 2016-08-11
- 0.1.0 — 2016-08-11

## README

# find-down [![Build status for find-down on Circle CI.](https://img.shields.io/circleci/project/sholladay/find-down/master.svg "Circle Build Status")](https://circleci.com/gh/sholladay/find-down "Find Down Builds")

> 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](https://github.com/sindresorhus/find-up) what `indexOf` is to `lastIndexOf`.

## Install

```sh
npm install find-down --save
```

## Usage

Get it into your program.

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

Find the topmost file with the given name.

```js
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`<br>
Default: `process.cwd()`

Directory to end with.

## Contributing

See our [contributing guidelines](https://github.com/sholladay/find-down/blob/master/CONTRIBUTING.md "The guidelines for participating in this project.") for more details.

1. [Fork it](https://github.com/sholladay/find-down/fork).
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](https://github.com/sholladay/find-down/compare "Submit code to this project for review.").

## License

[MPL-2.0](https://github.com/sholladay/find-down/blob/master/LICENSE "The license for find-down.") © [Seth Holladay](http://seth-holladay.com "Author of find-down.")

Go make something, dang it.

---
_Source: https://npm.io/package/find-down · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
