Socket
Socket
Sign inDemoInstall

require-main-filename

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    require-main-filename

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


Version published
Weekly downloads
21M
increased by2.98%
Maintainers
1
Install size
4.72 kB
Created
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

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 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc