https://github.com/node-modules/runscript
Run script easy!
https://github.com/node-modules/runscript
Last synced: about 1 month ago
JSON representation
Run script easy!
- Host: GitHub
- URL: https://github.com/node-modules/runscript
- Owner: node-modules
- License: other
- Created: 2016-02-04T15:59:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-12-10T02:21:23.000Z (5 months ago)
- Last Synced: 2025-03-15T07:03:46.526Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 41
- Watchers: 12
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-nodejs - runscript - Run script easy! (Repository / Shell)
README
# runscript
📢📢📢📢📢 You should use [execa](https://github.com/sindresorhus/execa) instead. 📢📢📢📢
---
[![NPM version][npm-image]][npm-url]
[](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/runscriptRun 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
[](https://github.com/node-modules/runscript/graphs/contributors)
Made with [contributors-img](https://contrib.rocks).