Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
CHANGELOG.md | D | 12-May-2024 | 852 | 27 | 12 | |
LICENSE.txt | D | 12-May-2024 | 731 | 15 | 12 | |
README.md | D | 12-May-2024 | 1 KiB | 27 | 18 | |
index.js | D | 12-May-2024 | 427 | 19 | 16 | |
package.json | D | 12-May-2024 | 1.7 KiB | 64 | 63 |
README.md
1# require-main-filename 2 3[![Build Status](https://travis-ci.org/yargs/require-main-filename.png)](https://travis-ci.org/yargs/require-main-filename) 4[![Coverage Status](https://coveralls.io/repos/yargs/require-main-filename/badge.svg?branch=master)](https://coveralls.io/r/yargs/require-main-filename?branch=master) 5[![NPM version](https://img.shields.io/npm/v/require-main-filename.svg)](https://www.npmjs.com/package/require-main-filename) 6 7`require.main.filename` is great for figuring out the entry 8point for the current application. This can be combined with a module like 9[pkg-conf](https://www.npmjs.com/package/pkg-conf) to, _as if by magic_, load 10top-level configuration. 11 12Unfortunately, `require.main.filename` sometimes fails when an application is 13executed with an alternative process manager, e.g., [iisnode](https://github.com/tjanczuk/iisnode). 14 15`require-main-filename` is a shim that addresses this problem. 16 17## Usage 18 19```js 20var main = require('require-main-filename')() 21// use main as an alternative to require.main.filename. 22``` 23 24## License 25 26ISC 27