# find-files-by-content

> Find files by content.

Latest version **1.0.0** (published 2015-12-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install find-files-by-content
pnpm add find-files-by-content
yarn add find-files-by-content
bun add find-files-by-content
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-12-25 |
| First published | 2015-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Riki Fridrich |
| Maintainers | fczbkk |

## Links

- npm: https://www.npmjs.com/package/find-files-by-content
- Repository: https://github.com/fczbkk/find-files-by-content
- Homepage: https://github.com/fczbkk/find-files-by-content/#readme
- Issues: https://github.com/fczbkk/find-files-by-content/issues
- npm.io page: https://npm.io/package/find-files-by-content

## Dependencies (2)

- [glob](https://npm.io/package/glob.md) ^6.0.2
- [async](https://npm.io/package/async.md) ^1.5.0

## Recent versions

- 1.0.0 (latest) — 2015-12-25

## README

# findFilesByContent

Find files that contain specific content.

## Installation

Use NPM:

```
$ npm install find-files-by-content
```

## How to use

```javascript
findFilesByContent(content_pattern, path_pattern, callback);
```

### content_pattern

Either string, regexp, or array containing combination of strings and/or regexps. Files containing them will be matched. If an array is used, it will match files containing ANY of the strings and/or regexps in it.

### path_pattern

String containing match pattern for file paths. It uses [minimatch syntax](https://github.com/isaacs/minimatch).

### callback

Function that will be called when check is done. Array of file paths will be passed as first argument.

## Example

I created this module because I needed a simple way to check my code for common problems before publishing. Here's how I use it: 

```javascript
var findFilesByContent = require('find-files-by-content');

// check if your production files contain forgotten debug messages
findFilesByContent('console.log', 'production/**/*.js', function (files) {
  console.log('Files containing debug messages:', files);
});

// check if all your tests are enabled
findFilesByContent(/^\s*(f|x)(it|describe)\(/, 'test/**/*.js', function (files) {
  console.log('Files containing disabled tests:', files);
});
```

## Bug reports, feature requests and contact

If you found any bugs, if you have feature requests or any questions, please, either [file an issue at GitHub](https://github.com/fczbkk/find-files-by-content/issues) or send me an e-mail at [riki@fczbkk.com](mailto:riki@fczbkk.com).

## License

Element Monitor is published under the [MIT license](https://github.com/fczbkk/find-files-by-content/blob/master/LICENSE).

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