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

include-folder

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

include-folder

expose the content of each file in a folder as an object property.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
961
decreased by-33.72%
Maintainers
1
Weekly downloads
 
Created
Source

include-folder

Build Status Npm module Code Climate

Expose the content of each file in a folder as an object property.

This module is browserifiable using the folderify transform

Getting Started

Install the module with: npm install include-folder --save

Then use like this:

var includeFolder = require('include-folder'),
    folder = includeFolder("./aFolder");

Supposing that the content of aFolder was the same as in the sample in test folder var will contains:

{
    file3OtherFile: 'this is file3OtherContent content',
    file1: 'this is file1 content',
    file1_1: 'this is file1_1 content'
}

Filter included files

You can filter which files to include using the filter parameter:

var includeFolder = require('include-folder'),
    folder = includeFolder("./aFolder",/^a.*/);

This only include files that start with 'a'

Filter parameters defaults to /^[^.].*$/, which include every file in the folder, except hidden ones (these that has a name starting with dot).

Preserve filenames

To prevent normalization and stripping of the extension in the result object, the preserveFilenames option can be used:

includeFolder('./www', null, { preserveFilenames: true });

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

License

Copyright (c) 2013 parroit Licensed under the MIT license.

Keywords

FAQs

Package last updated on 22 Aug 2015

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