node-tinycbor is currently slower than the built-in
JSON.parse() methods for Array and Object encode/decode. However,
node-tinycbor is quite fast when compared
to alternatives such as
node-msgpack. Benchmarks for
node-tinycbor can be found here.
This module provides the four following methods:
ArrayBuffercontaining the serialized data
decode(), which consumes a node
toJson(), which consumes a node
ArrayBufferobject and writes the JSON representation of said object into a
CBORtoJSON.jsonfile in the top directory
toText(), which consumes a node
ArrayBufferobject and writes the text representation of said object into a
CBORtoTEXT.txtfile in the top directory
toText(), if the file is not found, a new one will be generated. Otherwise, the CBOR conversion is appended to the existing file.
Encoding of Strings, Arrays, and Objects of up to length 100,000 is currently supported. Behavior is undefined for objects outside of the specified range.
undefined data types are also supported.
the resulting object at the end using
var assert = ;var CBOR = ;var obj = "a" : 1 "b" : 2 "c" : 1 2 3;var input = CBOR;var output = CBOR;assert;
To install node-tinycbor, use the following:
npm install tinycbor
This should allow use of node-tinycbor through
You will need node-gyp:
npm install -g node-gyp
Then from the root of the tinycbor repo, you can run: