# npm-spawn

> - Use npm programmatically

Latest version **0.1.0** (published 2016-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install npm-spawn
pnpm add npm-spawn
yarn add npm-spawn
bun add npm-spawn
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-05-20 |
| First published | 2016-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | zhongyuan |
| Maintainers | zhongyuan |

## Links

- npm: https://www.npmjs.com/package/npm-spawn
- Repository: https://github.com/zhouzhongyuan/npm-spawn
- Homepage: https://github.com/zhouzhongyuan/npm-spawn#readme
- Issues: https://github.com/zhouzhongyuan/npm-spawn/issues
- npm.io page: https://npm.io/package/npm-spawn

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Recent versions

- 0.1.0 (latest) — 2016-05-20
- 0.0.4 — 2016-05-19
- 0.0.3 — 2016-05-18

## README

# npm-spawn

- Use npm programmatically

- [Why not use like var npm = reuqire('npm')](https://github.com/npm/npm/issues/8283)

## In Cli
```
  npm install
```

## In npm-spawn
```
var npmCmd = require('npm-spawn');
npmCmd(['install'], options)
```
## Examples
```
npm install => npmCmd(['install'])
npm run build => npmCmd(['run','build])
```
### args
```
npm install ['install']
npm run build ['run', 'build']
```
### Options
[More Options](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)

format like below:
```
var options = {cwd:'src'};
```

- command <String> The command to run
- args <Array> List of string arguments
- options <Object>
- cwd <String> Current working directory of the child process
- env <Object> Environment key-value pairs
- stdio <Array> | <String> Child's stdio configuration. (See options.stdio)
- detached <Boolean> Prepare child to run independently of its parent process. Specific behavior depends on the platform, see options.detached)
- uid <Number> Sets the user identity of the process. (See setuid(2).)
- gid <Number> Sets the group identity of the process. (See setgid(2).)
- shell <Boolean> | <String> If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and 'cmd.exe' on Windows. A different shell can be specified as a string. The shell should understand the -c switch on UNIX, or /s /c on Windows. Defaults to false (no shell).

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