# require-path

> Require files from a directory tree recursively

Latest version **0.3.0** (published 2017-02-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install require-path
pnpm add require-path
yarn add require-path
bun add require-path
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2017-02-04 |
| First published | 2015-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ecowden |

## Links

- npm: https://www.npmjs.com/package/require-path
- npm.io page: https://npm.io/package/require-path

## Dependencies (2)

- [highland](https://npm.io/package/highland.md) ^2.5.1
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.3

## Recent versions

- 0.3.0 (latest) — 2017-02-04
- 0.2.0 — 2015-06-20
- 0.1.0 — 2015-06-18

## README

# require-path
Recursively `require(...)` files from a directory tree in Node.js

Works with Node.js `v4.0.0` and above.

| Branch        | Status        |
| ------------- |:-------------:|
| Master        | [![Build Status](https://travis-ci.org/ecowden/require-path.png?branch=master)](https://travis-ci.org/ecowden/require-path) |
| All           | [![Build Status](https://travis-ci.org/ecowden/require-path.png)](https://travis-ci.org/ecowden/require-path) |


## Usage

```js
var path = require('path');

requirePath({
    path: path.join(__dirname, 'my-directory'),
    include: ['**/*.js', '**/*.json'],
    exclude: ['**/*Spec.js']
  })
  // returns a standard promise
  .then(function (modules) {
    // `modules` is a map of filenames to require()'d components from those files
  })
  // don't forget to handle errors!
  .catch(handleError);
```

### Options

| Property | Description |
| -------- | ----------- |
| path     | _string_ or _array_ of absolute paths to search for files. Default: `.`. |
| include  | _string_ or _array_ of [minimatch](https://github.com/isaacs/minimatch) patterns. A file in the path(s) that match at least one pattern will be `require(...)`'d unless the file also matches an exclusion pattern. Default: `['**/*.js', '**/*.json']`.|
| exclude  | _string_ or _array_ of [minimatch](https://github.com/isaacs/minimatch) patterns. Files in the path(s) that match at least one pattern will be excluded. Default: `['**/*Spec.js']`. |

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