# extract-from-argv

> Extracts arguments that were passed when the Node.js process was launched.

Latest version **0.6.0** (published 2026-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install extract-from-argv
pnpm add extract-from-argv
yarn add extract-from-argv
bun add extract-from-argv
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2026-09-17 |
| First published | 2023-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | hansi_reit |
| Keywords | node, argv, arguments, extract |

## Links

- npm: https://www.npmjs.com/package/extract-from-argv
- Repository: https://github.com/hansireit/angular-lib
- Homepage: https://github.com/hansireit/angular-lib#readme
- Issues: https://github.com/hansireit/angular-lib/issues
- npm.io page: https://npm.io/package/extract-from-argv

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2

## Recent versions

- 0.6.0 (latest) — 2026-09-17
- 0.5.0 — 2026-07-14
- 0.4.21 — 2026-07-08
- 0.4.20 — 2026-06-25
- 0.4.19 — 2026-04-13
- 0.4.18 — 2026-04-01
- 0.4.17 — 2026-02-10
- 0.4.16 — 2026-02-06
- 0.4.15 — 2026-01-28
- 0.4.14 — 2025-09-16
- 0.4.13 — 2025-09-09
- 0.4.12 — 2025-08-14
- 0.4.11 — 2025-07-11
- 0.4.10 — 2025-06-11
- 0.4.8 — 2025-02-23
- … 15 more at https://npm.io/package/extract-from-argv/versions

## README

# extract-from-argv

Extracts arguments that were passed when the Node.js process was launched.

## Usage

**Pass arguments to the node process and read it**

```node my-script.js --port=4200```
```ts
const port = extractFromArgv('--port'); // Returns '4200'
```

**Custom separator**

```node my-script.js --port:4200```
```ts
const port = extractFromArgv('--port', { valueSeparator: ':' }); // Returns '4200'
```
**Custom argv object**
```ts
const port = extractFromArgv('--port', { argv: ['/usr/node', '--port=5000'] }); // Returns '5000'
```

**Arguments without values**

```node my-script.js --fun-mode```
```ts
// If an argument without an value is found it returns an empty string
extractFromArgv('--fun-mode'); // Returns ''

// If a argument was not found the function returns null
extractFromArgv('--angry-mode'); // Returns null'
```

---
_Source: https://npm.io/package/extract-from-argv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
