npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

require-otf

v0.1.0

Published

Require on-the-fly: A module adds ability to hot-reloading and lazy-loading on other modules

Downloads

2

Readme

Require-OTF

Require-OTF (Require on-the-fly) - A Node.js module brings ability to hot-reloading and lazy-loading on other modules. Written in new ES6 flavor.

Usage

You can just use the requireOTF as normal require() like this:

const requireOTF = require('require-otf').requireOTF(require);
const whatever = requireOTF('./path/to/module');

// ...

When you edit and save the module file that required like above, it will auto reloaded, unless it is a native module.

Additional you may pass an object with these optional parameters at the second argument to control the behaviour:

  • method: string, must be 'native' or 'polling', default is 'native', defines what method to determine the changes of JSON file. 'native' mode will use system API to detect, and 'polling' mode will poll the modefied time of the JSON file. In the most case 'native' is more efficient, but some of the operating system does not support this, in this case 'polling' should be used as fallback.
  • deferred: boolean, set it to true to not start loading the module until the first access on its properties, default is false.
  • resume: boolean, resume tracking if there are any slept file change tracker on the module required, default is false.
  • forceReload: boolean, force to reload the module even it is already loaded, default is false.
  • interval: integer, the checking interval if 'polling' mode is used. Default is 5000 milliseconds.
  • reloadDelay: integer, the delay between the file change notification received and reloading the module, default is 100 milliseconds.

Besides the functions and properties provided in native require() from Node, Require-OTF also provided these functions in the instances, you may use requireOTF.xxx to use them:

  • stopTrackAll(): Stop all module file change trackers.
  • stopTrack(module): Stop file change tracker belongs to the module path provided.
    • module: string, the path to the module in current scope.
  • resumeTrack(module, forceReload): Resume/restart file change tracker belongs to the module path provided.
    • module: string, the path to the module in current scope.
    • forceReload: boolean, true to force reload the module whatever it has been modified.
  • unload(module): Unloads a module from cache, stops its file change tracker if available. All references to this module through Require-OTF will be invalid.
    • module: string, the path to the module in current scope.
  • enabled: boolean, set to false to bypass everything, except for required modules, it is a global property and changing it will affect all Require-OTF instances in your application, default is true.

Install

With NPM:

$ npm i --save require-otf

License

MIT