# load-dir

> Recursivly load a directory

Latest version **0.0.3** (published 2015-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install load-dir
pnpm add load-dir
yarn add load-dir
bun add load-dir
```

## 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.0.3 |
| Published | 2015-03-06 |
| First published | 2015-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 0.x |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Beau Sorensen |
| Maintainers | sorensen |
| Keywords | type |

## Links

- npm: https://www.npmjs.com/package/load-dir
- Repository: https://github.com/sorensen/load-dir.js
- Issues: https://github.com/sorensen/load-dir.js/issues
- npm.io page: https://npm.io/package/load-dir

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^2.1.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2015-03-06
- 0.0.2 — 2015-03-06
- 0.0.1 — 2015-03-06

## README

load-dir
========

Recursively iterate through a directory and apply an iterator to the filepath. 
Includes shortcut methods for requiring or file reading.

Install
-------

With [npm](https://npmjs.org)

```
npm install load-dir
```

Usage
-----

Node.js

```js
var loadDir = require('load-dir')

// Require all .js files
var lib = loadDir(__dirname + '/lib/', function(fpath) {
  if (!!~fpath.indexOf('.js')) return require(fpath)
  return false
})

// Run require on all files, will break if non js files
var lib = loadDir.require(__dirname + '/lib/')
 
 // Load all .jade files 
var templates = loadDir(__dirname + '/templates/', function(fpath) {
  if (!!~fpath.indexOf('.jade')) return fs.readFileSync(fpath, 'utf8')
  return false
})

// Load every file found
var templates = loadDir.fs(__dirname + '/templates/')
```

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