Socket
Socket
Sign inDemoInstall

require-main-filename

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

require-main-filename

shim for require.main.filename() that works in as many environments as possible

    2.0.0latest
    GitHub
    npm

Version published
Maintainers
1
Weekly downloads
21,740,305
increased by6.04%

Weekly downloads

Package description

What is require-main-filename?

The require-main-filename package is a simple utility that helps you determine the main entry point filename of the currently running Node.js application. This can be particularly useful when you are writing a module that needs to know the entry point of the application it is being used in.

What are require-main-filename's main functionalities?

Get main entry point filename

This feature allows you to retrieve the filename of the main module that started the current application. The code sample demonstrates how to use the package to log the main filename to the console.

const requireMainFilename = require('require-main-filename');
console.log(requireMainFilename());

Other packages similar to require-main-filename

Changelog

Source

2.0.0 (2019-01-28)

Chores

  • drop support for Node 0.10 (#11) (87f4e13)

BREAKING CHANGES

  • drop support for Node 0.10/0.12

<a name="1.0.2"></a>

Readme

Source

require-main-filename

Build Status Coverage Status NPM version

require.main.filename is great for figuring out the entry point for the current application. This can be combined with a module like pkg-conf to, as if by magic, load top-level configuration.

Unfortunately, require.main.filename sometimes fails when an application is executed with an alternative process manager, e.g., iisnode.

require-main-filename is a shim that addresses this problem.

Usage

var main = require('require-main-filename')()
// use main as an alternative to require.main.filename.

License

ISC

Keywords

FAQs

Last updated on 28 Jan 2019

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc