Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

directory

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directory

require everything in a directory

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1K
decreased by-21.3%
Maintainers
1
Weekly downloads
 
Created
Source

node-directory

A simple module to require all files and directories inside a directory. By default it requires all files in the current directory except itself, and maps them to a callback.

Example

As an example, this may be your index.js file in a directory that contains all of the schemas for your models. The call to directory will require all of the (other) files in the current directory and loop through them.


module.exports = function (models, options) {
  options = options || { debug:false }

  require('directory')(function (module, name) {
    models.model(name, module, options)
  })

}

Require a different directory:


require('directory')(__dirname + '/plugins/', function (module, name) {
  models.plugin(module, options)
})

Installation

npm install directory --save

Usage

require('directory')([dirname,] iterator)

MIT License

FAQs

Package last updated on 25 Dec 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc