Socket
Book a DemoInstallSign in
Socket

call-dir

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

call-dir

Loads files from a directory and executes a callback for each

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
-80%
Maintainers
1
Weekly downloads
 
Created
Source

call-dir

Greenkeeper badge Build Status License npm version npm downloads

call-dir loads files from a directory and executes a callback for each one. Directory path is relative to the current working directory (process.cwd()). All dot files are ignored.

Installation

$ npm install call-dir

Usage

load(path: string, callback: (path: string, filename: string) => void): void

import load from "call-dir";

load("./path/to/stuff", (path, filename) => {
    console.log(`Found file: ${filename} (absolute path: ${path})`);
});

// You can initialize modules from a directory easily:
load("./models", path => require(path)(some, variables, ...here));
load("./routes", path => require(path)(some, variables, ...here));

Tests

$ npm test

Keywords

require

FAQs

Package last updated on 08 Oct 2017

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