This package provides an extensible CBOR encoder/decoder.
var CBOR = ;var encodedBuffer = CBOR;var decodedObject = CBOR;
Much like the
toJSON() method, which allows objects to provide a replacement representation for encoding, this package checks for a
Note that this step happens after any semantic-tagging/-replacement step, so a custom semantic encoder will always override an objects built-in
CBOR provides a limited set of basic types (similar to JSON), but provides semantic tagging (optional for both encoder/decoder) that lets you annotate parts of the data so they can be decoded appropriately.
Here is an example (from this module) for encoding Date objects as ISO strings:
// 0 is the CBOR semantic tag number for date/time strings:CBOR;CBOR;
- All floats encoded as 64-bit, regardless of whether they strictly need to be