npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cbor-cli

v9.0.2

Published

Command line tools to encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).

Downloads

60

Readme

cbor-cli

A command-line interface for encoding and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).

Supported Node.js versions

This project now only supports versions of Node that the Node team is currently supporting. Ava's support statement is what we will be using as well. Currently, that means Node 10+ is required. If you need to support an older version of Node (back to version 6), use cbor version 5.2.x, which will get nothing but security updates from here on out.

Installation:

$ npm install -g cbor-cli

Documentation:

There is a full API that this library depends on.

For all of these tools, if a hex string is not specified, or if the file name provided is -, they will read from stdin and write to stdout.

From the command line:

cbor

$ cbor.js -h
Usage: cbor [options]

Options:
  -V, --version      output the version number
  -c, --color        Force color output even if stdout is not a TTY
  -t, --type <type>  Output type (one of: javascript, diagnose, comment) (default: "javascript")
  -h, --help         display help for command

Starts a Read, Edit, Print Loop (REPL), with the cbor package and all of its symbols already available. Almost everything you do in the REPL will also output the CBOR encoding of the result in hex, after the normal result.

cbor2comment

$ cbor2comment -h
Usage: cbor2comment [options] <file ...>

Options:
  -V, --version           output the version number
  -x, --hex <string>      Hex string input
  -t, --tabsize [spaces]  Indent amount
  -h, --help              display help for command

Convert the given file or hex string into the CBOR comment format. This is useful for understanding what each byte means.

cbor2diag

$ cbor2diag -h
Usage: cbor2diag [options] <file ...>

Options:
  -V, --version       output the version number
  -x, --hex <STRING>  Hex string input
  -h, --help          display help for command

Convert the given file or hex string into the CBOR diagnostic format. This is useful for getting a slightly more nuanced view into what CBOR came in on the wire than you would if you turned it all the way into javascript.

cbor2js

$ cbor2js -h
Usage: cbor2js [options] <file ...>

Options:
  -V, --version       output the version number
  -x, --hex <STRING>  Hex string input
  -H, --hidden        Include non-enumerable symbols and properties
  -h, --help          display help for command

Convert the given file or hex string into javascript objects, then use util.inspect to format them for consumption. This usually gives a much better idea of type information, and is easier to read than JSON.

cbor2json

$ cbor2json -h
Usage: cbor2json [options] <file ...>

Options:
  -V, --version       output the version number
  -x, --hex <STRING>  Hex string input
  -h, --help          display help for command

Convert the given file or hex string into JSON. This loses type information, but does the best it can if you want interoperability with existing JSON tooling. For example, JSON can't express Dates, so they are output as ISO 8601 strings.

js2cbor

$ js2cbor -h
Usage: js2cbor [options] <file ...>

Options:
  -V, --version    output the version number
  -x, --hex        Hex string output
  -c, --canonical  Canonical output
  -h, --help       display help for command

Read the input files or stdin as if it were a commonjs package

json2cbor

$ json2cbor -h
Usage: json2cbor [options] <file ...>

Options:
  -V, --version    output the version number
  -x, --hex        Hex string output
  -c, --canonical  Canonical output
  -h, --help       display help for command

Converts the given JSON or JSON Text Sequence file into binary CBOR. If -x is given, instead outputs a hex-encoded version of the CBOR.