https://github.com/mcollina/bcksrv
Serve your commands like a pro
https://github.com/mcollina/bcksrv
Last synced: 6 months ago
JSON representation
Serve your commands like a pro
- Host: GitHub
- URL: https://github.com/mcollina/bcksrv
- Owner: mcollina
- License: mit
- Created: 2014-08-20T13:07:58.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-09-17T16:27:16.000Z (about 11 years ago)
- Last Synced: 2025-04-03T04:06:02.424Z (7 months ago)
- Language: JavaScript
- Size: 199 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bcksrv
======
__bcksrv__ is a tiny module to build command servers easily,
securely and error-safe.
This module support the same escaping and quoting of shell commands.
It is implemented through the [shell-quote](http://npm.im/shell-quote) module.
Example
-------
```js
var server = require('net').createServer()
, srv = require('./')()
srv.register('echo', function(rest, stream, cb) {
stream.write(rest.join(' '))
stream.write('\n')
cb()
})
srv.register('err', function(rest, stream, cb) {
cb(new Error('muahha'))
})
server.on('connection', function(conn) {
conn.pipe(srv.stream()).pipe(conn)
})
server.listen(3000)
```
Acknowledgements
----------------
This project was kindly sponsored by [nearForm](http://nearform.com).
License
-------
MIT