0.2.0 • Published 6 years ago
msgpack-cli v0.2.0
MessagePack CLI
Install
You can install, globally is recommended, the CLI from the npm registry:
$ npm i -g msgpack-cliUsage
After installation, the msgpack command can be used, outlined by msgpack --help, as follows:
Converts JSON/YAML to MessagePack, and vice-versa.
USAGE
$ msgpack [INPUT]
OPTIONS
-J, --json-out convert MessagePack -> JSON
-Y, --yaml-out convert MessagePack -> YAML
-h, --help show CLI help
-i, --indent=indent number of indentation spaces to use
-j, --json-in convert JSON -> MessagePack
-o, --output=output write output to this file
-v, --version show CLI version
-y, --yaml-in convert YAML -> MessagePackNote: MessagePack input is expected in Base64 encoding.
Examples
The msgpack command accepts input as arguments:
$ msgpack -j '{"message": "Hello, world!"}'
gadtZXNzYWdlrUhlbGxvLCB3b3JsZCE=
$ msgpack -J -i=2 gadtZXNzYWdlrUhlbGxvLCB3b3JsZCE=
{
"message": "Hello, world!"
}Or, msgpack can read input from, and write output to, a file:
$ msgpack -J -i=2 gadtZXNzYWdlrUhlbGxvLCB3b3JsZCE= -o file.json
$ msgpack -j file.json
gadtZXNzYWdlrUhlbGxvLCB3b3JsZCE=It also accepts input via stdin, supporting the use of pipes:
$ msgpack -j '{"message": "Hello, world!"}' | msgpack -J -i=2
{
"message": "Hello, world!"
}