You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.0 KiB

4 years ago
  1. # require-main-filename
  2. [![Build Status](https://travis-ci.org/yargs/require-main-filename.png)](https://travis-ci.org/yargs/require-main-filename)
  3. [![Coverage Status](https://coveralls.io/repos/yargs/require-main-filename/badge.svg?branch=master)](https://coveralls.io/r/yargs/require-main-filename?branch=master)
  4. [![NPM version](https://img.shields.io/npm/v/require-main-filename.svg)](https://www.npmjs.com/package/require-main-filename)
  5. `require.main.filename` is great for figuring out the entry
  6. point for the current application. This can be combined with a module like
  7. [pkg-conf](https://www.npmjs.com/package/pkg-conf) to, _as if by magic_, load
  8. top-level configuration.
  9. Unfortunately, `require.main.filename` sometimes fails when an application is
  10. executed with an alternative process manager, e.g., [iisnode](https://github.com/tjanczuk/iisnode).
  11. `require-main-filename` is a shim that addresses this problem.
  12. ## Usage
  13. ```js
  14. var main = require('require-main-filename')()
  15. // use main as an alternative to require.main.filename.
  16. ```
  17. ## License
  18. ISC