# runscript

> Run script easy!

Latest version **2.0.1** (published 2024-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install runscript
pnpm add runscript
yarn add runscript
bun add runscript
```

## Health

**Score 45/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2024-12-10 |
| First published | 2016-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 1 |
| Unpacked size | 41.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 41 |
| Author | fengmk2 |
| Maintainers | atian25, dead_horse, fengmk2, popomore |
| Keywords | runscript, run-script, npm run |

## Links

- npm: https://www.npmjs.com/package/runscript
- Repository: https://github.com/node-modules/runscript
- Issues: https://github.com/node-modules/runscript/issues
- npm.io page: https://npm.io/package/runscript

## Dependencies (1)

- [is-type-of](https://npm.io/package/is-type-of.md) ^2.2.0

## Recent versions

- 2.0.1 (latest) — 2024-12-10
- 2.0.0 — 2024-12-09
- 1.6.0 — 2024-01-11
- 1.5.4 — 2024-01-11
- 1.5.3 — 2022-05-20
- 1.5.2 — 2022-03-08
- 1.5.1 — 2021-05-07
- 1.5.0 — 2020-05-22
- 1.4.0 — 2019-07-06
- 1.3.1 — 2019-06-14
- 1.3.0 — 2017-07-28
- 1.2.1 — 2017-02-22
- 1.2.0 — 2017-02-04
- 1.1.0 — 2016-03-06
- 1.0.0 — 2016-02-04
- … 1 more at https://npm.io/package/runscript/versions

## README

# runscript

📢📢📢📢📢 You should use [execa](https://github.com/sindresorhus/execa) instead. 📢📢📢📢

---

[![NPM version][npm-image]][npm-url]
[![Node.js CI](https://github.com/node-modules/runscript/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/runscript/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/runscript.svg?style=flat-square
[npm-url]: https://npmjs.org/package/runscript
[codecov-image]: https://codecov.io/github/node-modules/runscript/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/node-modules/runscript?branch=master
[download-image]: https://img.shields.io/npm/dm/runscript.svg?style=flat-square
[download-url]: https://npmjs.org/package/runscript

Run script easy!

## Installation

```bash
npm install runscript
```

## Quick start

Commonjs

```js
const { runScript } = require('runscript');

runScript('node -v', { stdio: 'pipe' })
  .then(stdio => {
    console.log(stdio);
  })
  .catch(err => {
    console.error(err);
  });
```

ESM & TypeScript

```js
import { runScript } from 'runscript';

runScript('node -v', { stdio: 'pipe' })
  .then(stdio => {
    console.log(stdio);
  })
  .catch(err => {
    console.error(err);
  });
```

### run with timeout

Run user script for a maximum of 10 seconds.

```js
const { runScript } = require('runscript');

runScript('node user-script.js', { stdio: 'pipe' }, { timeout: 10000 })
  .then(stdio => {
    console.log(stdio);
  })
  .catch(err => {
    console.error(err);
  });
```

## Upgrade from 1.x to 2.x

```js
// 1.x
// const runscript = require('runscript');

// 2.x
const { runscript } = require('runscript');
```

## License

[MIT](LICENSE.txt)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=node-modules/runscript)](https://github.com/node-modules/runscript/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).

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