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

cache-free-require

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-free-require

Require modules with no caching in Node.js.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
511
decreased by-7.26%
Maintainers
1
Weekly downloads
 
Created
Source

cache-free-require

Require modules with no caching in Node.js.

why

In developing Node.js apps, we need to restart Node.js server every time code changed. Using nodemon maybe a way to solve this. But when the Node.js server is too complicated, it's time consuming to restart.

cache-free-require is suitable when we frequently change a little parts of code.

cache-free-require can require a module with no cache, it will always read the file content.

how

const {freeCache} = require('cache-free-require');

// can be string or RegExp
// if regExp.test(filename) === true or string === filename
// there will be no cache
freeCache([
    /app\/index\.js/,
    '/absolute/path/to/child',
]);

require('app/index.js');

or by single require

const {cacheFreeRequire} = require('cache-free-require');
cacheFreeRequire('./path/to/module', __dirname);
cacheFreeRequire('some-module', __dirname);

or

const {makeRequire} = require('cache-free-require');
const cacheFreeRequire = makeRequire(__dirname);

cacheFreeRequire('./path/to/module');
cacheFreeRequire('some-module');

notice

  • Only support .js and .json, other file will be treated as .js.
  • Only can be used on files with no state, otherwise the state will not be persisted.

Keywords

FAQs

Package last updated on 06 Jul 2023

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