0.6.3 • Published 4 years ago

dag-cbor-sync v0.6.3

Weekly downloads
189
License
Apache-2.0
Repository
github
Last release
4 years ago

Synchronous seralization/deserialization for dag-cbor nodes

Usage:

let cbor = require('dag-cbor-sync')()
let buffer = cbor.serialize({test: 1234})
let obj = cbor.deserialize(buffer)

With links

let buffer = cbor.serialize(
  /* Object with single '/' property of a base encoded CID represents
     a link
  */
  {test: {'/': 'zdpuAkv7jA671owT26AnJiFXG9usHmCAW6MTzpwFJw46X1PLG'}}
)
let obj = cbor.deserialize(buffer)
Buffer.isBuffer(obj.test['/']) // true

require('dag-cbor-sync')(maxsize)

Optionally set the maximum size of the cbor node. Node's larger will throw an exception.

serialize(object)

Returns a buffer of the binary representation of the object.

deserialize(buffer)

Returns the native representation.

Note the link CID's will already be converted to buffers.

0.6.3

4 years ago

0.6.2

4 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.2.0

6 years ago

0.1.0

6 years ago