dag-cbor-sync

Synchronous serialize/deserialize for IPLD dag-cbor.

ipld-dag-cbor is now synchronous, this library is useless.
Last updated 6 years ago by mikeal .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dag-cbor-sync 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.6.3                                ...           latest (6 years ago)

7 Versions

  • 0.6.3 [deprecated]           ...           6 years ago
  • 0.6.2 [deprecated]           ...           6 years ago
  • 0.6.0 [deprecated]           ...           7 years ago
  • 0.5.0 [deprecated]           ...           7 years ago
  • 0.4.0 [deprecated]           ...           7 years ago
  • 0.2.0 [deprecated]           ...           8 years ago
  • 0.1.0 [deprecated]           ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |