https://github.com/hugoalh-studio/argv-nodejs
A NodeJS module to correctly slice off `process.argv`.
https://github.com/hugoalh-studio/argv-nodejs
argv nodejs
Last synced: 6 months ago
JSON representation
A NodeJS module to correctly slice off `process.argv`.
- Host: GitHub
- URL: https://github.com/hugoalh-studio/argv-nodejs
- Owner: hugoalh-studio
- License: other
- Created: 2023-03-11T03:51:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-25T00:50:45.000Z (9 months ago)
- Last Synced: 2024-09-26T17:36:56.193Z (8 months ago)
- Topics: argv, nodejs
- Language: TypeScript
- Homepage:
- Size: 313 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Argv (NodeJS)
[**âī¸** MIT](./LICENSE.md)
[](https://github.com/hugoalh-studio/argv-nodejs)
[](https://www.npmjs.com/package/@hugoalh/argv)A NodeJS module to correctly slice off [`process.argv`](https://nodejs.org/api/process.html#processargv).
## đ° Begin
### đ¯ Targets
| | **Registry - NPM** |
|:--|:--|
| **[NodeJS](https://nodejs.org/)** >= v16.13.0 | [âī¸ `node_modules`](https://docs.npmjs.com/using-npm-packages-in-your-projects) |> **âšī¸ Note**
>
> It is possible to use this module in other methods/ways which not listed in here, however it is not officially supported.### #ī¸âŖ Registries Identifier
- **NPM:**
```
@hugoalh/is-primitive
```> **âšī¸ Note**
>
> - Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `package.json`](./package.json) property `exports` for available sub paths.
> - It is recommended to use this module with tag for immutability.### đĄī¸ Permissions
*This module does not require any permission.*
## đ§Š APIs
- ```ts
const args: string;// Additional command line arguments.
```
- ```ts
const binIndex: 0 | 1;// Index of bin in the `process.argv`.
```
- ```ts
const binPath: string;// Path of the file is execute.
```
- ```ts
const isBundledElectronJSProgram: boolean;// Whether the process is execute from the bundled ElectronJS program.
```
- ```ts
const isElectronJSProgram: boolean;// Whether the process is execute from the ElectronJS program.
```
- ```ts
const isUnbundledElectronJSProgram: boolean;// Whether the process is execute from the unbundled ElectronJS program.
```
- ```ts
const programPath: string;// Path of the executable file is execute.
```## âī¸ Examples
| **`argv.________`** | **`node bin.js args1 args2 ...argsN`** | **`bin args1 args2 ...argsN`** | **`electron bin.js args1 args2 ...argsN`** |
|:-:|:-:|:-:|:-:|
| **`args`** | `["args1", "args2", ..., "argsN"]` | `["args1", "args2", ..., "argsN"]` | `["args1", "args2", ..., "argsN"]` |
| **`binIndex`** | `1` | `0` | `1` |
| **`binPath`** | `"/path-to/bin.js"` | `"/path-to/bin"` | `"/path-to/bin.js"` |
| **`isBundledElectronJSProgram`** | `false` | `true` | `false` |
| **`isElectronJSProgram`** | `false` | `true` | `true` |
| **`isUnbundledElectronJSProgram`** | `false` | `false` | `true` |
| **`programPath`** | `"/path-to/node"` | `"/path-to/bin"` | `"/path-to/electron"` |