borc
Version:
Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).
28 lines (22 loc) • 551 B
JavaScript
const cbor = require('../src')
const utils = require('../src/utils')
const pkg = require('../package.json')
const opts = require('commander')
.version(pkg.version)
.usage('[options] <file ...>')
.option('-x, --hex [STRING]', 'Hex string input')
.parse(process.argv)
const argv = opts.args
if (opts.hex) {
argv.push(new utils.DeHexStream(opts.hex))
}
if (argv.length === 0) {
argv.push('-')
}
utils.streamFiles(argv, function () {
const d = new cbor.Diagnose()
d.pipe(process.stdout)
return d
})