Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | # require-main-filename
|
---|
2 |
|
---|
3 | [](https://travis-ci.org/yargs/require-main-filename)
|
---|
4 | [](https://coveralls.io/r/yargs/require-main-filename?branch=master)
|
---|
5 | [](https://www.npmjs.com/package/require-main-filename)
|
---|
6 |
|
---|
7 | `require.main.filename` is great for figuring out the entry
|
---|
8 | point 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
|
---|
10 | top-level configuration.
|
---|
11 |
|
---|
12 | Unfortunately, `require.main.filename` sometimes fails when an application is
|
---|
13 | executed 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
|
---|
20 | var main = require('require-main-filename')()
|
---|
21 | // use main as an alternative to require.main.filename.
|
---|
22 | ```
|
---|
23 |
|
---|
24 | ## License
|
---|
25 |
|
---|
26 | ISC
|
---|
Note:
See
TracBrowser
for help on using the repository browser.