0.2.0 • Published 10 years ago

bcksrv v0.2.0

Weekly downloads
9
License
MIT
Repository
github
Last release
10 years ago

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 module.

Example

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.

License

MIT