CBOR(1)

πŸ“¦
version 8.1.0 Β· 3 versions
, in ubuntu noble, ubuntu resolute

πŸ’– CBOR(1) β€” the cbor bestie manual πŸ’–

okay so hi, you're looking at the manual for cbor, and honestly? she ate. let's get into it πŸ’…


✨ NAME ✨

cbor β€” Batteries-included CBOR Read, Edit, Print Loop πŸ¦‹

like, a whole REPL but make it CBOR. periodt.


🌸 SYNOPSIS 🌸

  # cbor
  cbor [VERSION] (javascript output from typing 0x00)
  cbor> ...
  ^D

that's the whole vibe. you type stuff, she prints stuff, you hit ^D and go touch grass 🌱


πŸ’œ DESCRIPTION πŸ’œ

so cbor is basically a version of the Node Read, Edit, Print Loop (that's the REPL, docs live at https://nodejs.org/api/repl.html) β€” but with a glow-up ✨

here's what's different in this REPL, no cap:

  • most interactive results output are followed by their CBOR representation πŸ”₯
  • input that starts with 0x, ', ", or ` and is followed only by hex digits gets taken as a hex-encoded binary string, decoded, and displayed in a format based on the --type option πŸ‘‘
  • the following are already imported and in-scope of the REPL, so you don't gotta do anything:
    • the cbor package
    • the nofilter package (as NoFilter)
    • all of the properties and functions of the cbor package (e.g. encode, decode)
    • Promises are automatically awaited, their results printed, and their results going into the _ variable rather than the promise itself 🫢
heads up bestie πŸŽ€ by default this command shares its history with the main Node REPL, in the file ~/.node_repl_history. if you wanna modify that, set the NODE_REPL_HISTORY environment variable to the name of a file, or '' to disable history. (more on that below, i gotchu)

πŸŽ€ 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 πŸ₯² (yes the sentence just. ends there. i'm not fixing it, it's iconic)

πŸ¦‹ ENVIRONMENT VARIABLES πŸ¦‹

All of the normal environment variables from Node apply. In particular:

  • NODE_REPL_HISTORY β€” When a valid path is given, persistent REPL history will be saved to the specified file rather than .node_repl_history in the user's home directory. Setting this value to '' (an empty string) will disable persistent REPL history. Whitespace will be trimmed from the value. On Windows platforms environment variables with empty values are invalid so set this variable to one or more spaces to disable persistent REPL history. πŸ’€ (windows pls)
  • NODE_REPL_HISTORY_SIZE β€” Controls how many lines of history will be persisted if history is available. Must be a positive number. Default: 1000. πŸ“
  • NODE_REPL_MODE β€” May be either 'sloppy' or 'strict'. Default: 'sloppy', which will allow non-strict mode code to be run. 😌

πŸ’… SEE ALSO πŸ’…


and that's the page bestie, you're officially certified πŸ’– this was CBOR(1), from November 2022 β€” go forth and decode, you absolute main character πŸ‘‘βœ¨

πŸ“¦ where this page comes from