https://github.com/coderaiser/spawnify
Create new process in node.
https://github.com/coderaiser/spawnify
cloudcmd emitter execute javascript nodejs process spawn
Last synced: 6 months ago
JSON representation
Create new process in node.
- Host: GitHub
- URL: https://github.com/coderaiser/spawnify
- Owner: coderaiser
- License: mit
- Created: 2014-08-22T13:55:04.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-08-10T08:55:59.000Z (over 2 years ago)
- Last Synced: 2025-05-16T17:06:34.182Z (7 months ago)
- Topics: cloudcmd, emitter, execute, javascript, nodejs, process, spawn
- Language: JavaScript
- Size: 117 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# Spawnify [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
[NPMIMGURL]: https://img.shields.io/npm/v/spawnify.svg?style=flat
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/spawnify/master.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/spawnify "npm"
[BuildStatusURL]: https://travis-ci.org/coderaiser/spawnify "Build Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
Create new processes, change directories, auto switch between spawn and exec.
## Install
```
npm i spawnify --save
```
## How to use?
```js
const spawnify = require('spawnify');
const spawn = spawnify('ls -lha', {
cwd: __dirname,
});
spawn.on('error', (error) => {
console.error(error.message);
});
/* not mandatory */
spawn.on('data', (data) => {
console.log(data);
});
/* not mandatory */
spawn.on('start', () => {
console.log('process has been started');
// kill process after start
spawn.kill();
});
/* not mandatory */
spawn.on('path', (path) => {
console.log('directory was changed', path);
});
/* not mandatory */
spawn.on('close', () => {
console.log('process closed');
});
/* not mandatory */
spawn.on('exit', () => {
console.log('process closed');
});
```
## License
MIT