# ignore-walk

> Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.

Latest version **9.0.0** (published 2026-05-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install ignore-walk
pnpm add ignore-walk
yarn add ignore-walk
bun add ignore-walk
```

## Health

**Score 58/100 (C)** — status: active.

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 9.0.0 |
| Published | 2026-05-08 |
| First published | 2017-05-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/ignore-walk) |
| Module format | CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 1 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 67 |
| Author | GitHub Inc. |
| Maintainers | saquibkhan, npm-cli-ops, reggi, owlstronaut |
| Keywords | ignorefile, ignore, file, .gitignore, .npmignore, glob |

## Links

- npm: https://www.npmjs.com/package/ignore-walk
- Repository: https://github.com/npm/ignore-walk
- Homepage: https://github.com/npm/ignore-walk#readme
- Issues: https://github.com/npm/ignore-walk/issues
- npm.io page: https://npm.io/package/ignore-walk

## Dependencies (1)

- [minimatch](https://npm.io/package/minimatch.md) ^10.0.3

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 9.0.0 (latest) — 2026-05-08
- 8.0.0 — 2025-07-24
- 7.0.0 — 2024-09-04
- 6.0.5 — 2024-05-04
- 6.0.4 — 2023-11-29
- 6.0.3 — 2023-04-26
- 6.0.2 — 2023-03-21
- 6.0.1 — 2023-02-07
- 6.0.0 — 2022-10-14
- 5.0.1 — 2022-04-06
- 5.0.0 — 2022-04-06
- 4.0.1 — 2021-08-23
- 4.0.0 — 2021-08-23
- 3.0.4 — 2021-05-06
- 3.0.3 — 2019-10-09
- … 13 more at https://npm.io/package/ignore-walk/versions

## README

# ignore-walk

Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.

Walk a directory creating a list of entries, parsing any `.ignore`
files met along the way to exclude files.

## USAGE

```javascript
const walk = require('ignore-walk')

// All options are optional, defaults provided.

// this function returns a promise, but you can also pass a cb
// if you like that approach better.
walk({
  path: '...', // root dir to start in. defaults to process.cwd()
  ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']
  includeEmpty: true|false, // true to include empty dirs, default false
  follow: true|false // true to follow symlink dirs, default false
}, callback)

// to walk synchronously, do it this way:
const result = walk.sync({ path: '/wow/such/filepath' })
```

If you want to get at the underlying classes, they're at `walk.Walker`
and `walk.WalkerSync`.

## OPTIONS

* `path` The path to start in.  Defaults to `process.cwd()`

* `ignoreFiles` Filenames to treat as ignore files.  The default is
  `['.ignore']`.  (This is where you'd put `.gitignore` or
  `.npmignore` or whatever.)  If multiple ignore files are in a
  directory, then rules from each are applied in the order that the
  files are listed.

* `includeEmpty` Set to `true` to include empty directories, assuming
  they are not excluded by any of the ignore rules.  If not set, then
  this follows the standard `git` behavior of not including
  directories that are empty.

    Note: this will cause an empty directory to be included if it
    would contain an included entry, even if it would have otherwise
    been excluded itself.

    For example, given the rules `*` (ignore everything) and `!/a/b/c`
    (re-include the entry at `/a/b/c`), the directory `/a/b` will be
    included if it is empty.

* `follow`  Set to `true` to treat symbolically linked directories as
  directories, recursing into them.  There is no handling for nested
  symlinks, so `ELOOP` errors can occur in some cases when using this
  option.  Defaults to `false`.

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