2.0.0 • Published 9 years ago

sshconf v2.0.0

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

sshconf

sshconf is a robust, streaming ssh config parser.

Build status

Install

$ npm install sshconf

Usage

var fs = require('fs')
var parse = require('sshconf/parse')
var through = require('through2')

fs.createReadStream('/path/to/ssh_config')
  .pipe(parse())
  .pipe(stringify())
  .pipe(process.stdout)

function stringify () {
  return through.obj(function (json, enc, next) {
    next(null, JSON.stringify(json) + '\n')
  })
}

Get parsed data as a single object

var fs = require('fs')
var parse = require('sshconf/parse')
var merge = require('sshconf/merge')

fs.createReadStream('/path/to/ssh_config')
  .pipe(parse())
  .pipe(merge(function (err, parsed) {
    console.log(JSON.stringify(parsed, null, 2))
  }))

License

MIT