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

local-lib

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

local-lib

Load a local library as a global module.

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by14.29%
Maintainers
1
Weekly downloads
 
Created
Source

local-lib

Node.js require your local library files/modules easily from anywhere in your project without having to navigate directories.

painful

	var db = require('../../../../lib/db');

the local-lib way

	var db = require('local-lib').db;

Installation

npm install local-lib

Usage

  1. add a lib or library folder in your project root.
  2. add .js files, .json files, or module folders to your library
  3. access your library easily using global require

Library folders should contain an index.js to export your library, or a package.json file with a main directive to point to your main file.

Example

project structure

project root
├── lib
│   ├── utils
│   │   └── index.js
│   └── db.js
└── app.js

app.js

	var lib = require('local-lib');
	var db = lib.db;
	var utils = lib.utils;

or

	var db = require('local-lib').db;

Keywords

FAQs

Package last updated on 10 Jan 2014

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