requirefresh

  • Version 5.13.0
  • Published
  • 41.6 kB
  • No dependencies
  • Artistic-2.0 license

Install

npm i requirefresh
yarn add requirefresh
pnpm add requirefresh

Overview

Require a file without adding it into the require cache

Index

Variables

variable requireFreshSafe

const requireFreshSafe: (path: string, next: Errback) => void;

    Functions

    function requireFresh

    requireFresh: (path: string) => any;
    • Require the path without any caching.

      Parameter path

      the path to require

      Returns

      the result of the require call

      Throws

      note that the require call may throw if something went wrong requiring the path

    function requireFreshCallback

    requireFreshCallback: (path: string, next: Errback) => void;
    • Require the path without any caching, but catch errors into the callback. Error cannot be returned because what if the module intended to RETURN (not throw) an error, hence why callback is used, as it can differentiate between returned and thrown errors.

      Parameter path

      the path to require

      Parameter next

      the callback

      Returns

      {void}

    function requireFreshPromise

    requireFreshPromise: (path: string) => Promise<unknown>;
    • Require the path without any caching, but catch errors into the callback. Error cannot be returned because what if the module intended to RETURN (not throw) an error, hence why promise is used, as it can differentiate between returned and thrown errors.

      Parameter path

      the path to require

      Returns

      {void}

    Type Aliases

    type Errback

    type Errback = (error: Error | undefined, result: any) => any;
    • Require Fresh Callback in typical errback style.

      Parameter error

      if the require call threw, this is its error

      Parameter result

      if the require call performed succesfully, this is its result

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (16)

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/requirefresh.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/requirefresh)
    • HTML
      <a href="https://www.jsdocs.io/package/requirefresh"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>