@ipld/dag-json
JS implementation of DAG-JSON
Last updated 9 days ago by GitHub Actions .
Apache-2.0 OR MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ipld/dag-json 
SYNC missed versions from official npm registry.

@ipld/dag-json

codecov CI

JS implementation of DAG-JSON

Table of contents

Install

$ npm i @ipld/dag-json

Example

import { encode, decode } from '@ipld/dag-json'
import { CID } from 'multiformats'

const obj = {
  x: 1,
  /* CID instances are encoded as links */
  y: [2, 3, CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')],
  z: {
    a: CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'),
    b: null,
    c: 'string'
  }
}

let data = encode(obj)
let decoded = decode(data)
decoded.y[0] // 2
CID.asCID(decoded.z.a) // cid instance

Usage

@ipld/dag-json is designed to be used within multiformats but can be used separately. encode(), decode() are available as exports, as are name and code to match with the corresponding DAG-JSON multicodec.

License

Licensed under either of

Contribute

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Current Tags

  • 10.2.7                                ...           latest (9 days ago)

79 Versions

  • 10.2.7                                ...           9 days ago
  • 10.2.6                                ...           3 months ago
  • 10.2.5                                ...           a year ago
  • 10.2.4                                ...           a year ago
  • 10.2.3                                ...           a year ago
  • 10.2.2                                ...           2 years ago
  • 10.2.1                                ...           2 years ago
  • 10.2.0                                ...           2 years ago
  • 10.1.7                                ...           2 years ago
  • 10.1.6                                ...           2 years ago
  • 10.1.5                                ...           3 years ago
  • 10.1.4                                ...           3 years ago
  • 10.1.3                                ...           3 years ago
  • 10.1.2                                ...           3 years ago
  • 10.1.1                                ...           3 years ago
  • 10.1.0                                ...           3 years ago
  • 10.0.1                                ...           3 years ago
  • 10.0.0                                ...           3 years ago
  • 9.1.1                                ...           3 years ago
  • 9.1.0                                ...           3 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.11                                ...           4 years ago
  • 8.0.10                                ...           4 years ago
  • 8.0.9                                ...           4 years ago
  • 8.0.8                                ...           4 years ago
  • 8.0.7                                ...           4 years ago
  • 8.0.6                                ...           4 years ago
  • 8.0.5                                ...           4 years ago
  • 8.0.4                                ...           4 years ago
  • 8.0.3                                ...           4 years ago
  • 8.0.2                                ...           4 years ago
  • 8.0.1                                ...           5 years ago
  • 8.0.0                                ...           5 years ago
  • 7.0.8                                ...           5 years ago
  • 7.0.7                                ...           5 years ago
  • 7.0.6                                ...           5 years ago
  • 7.0.5                                ...           5 years ago
  • 7.0.4                                ...           5 years ago
  • 7.0.3                                ...           5 years ago
  • 7.0.2                                ...           5 years ago
  • 7.0.1                                ...           5 years ago
  • 7.0.0                                ...           5 years ago
  • 6.0.0                                ...           5 years ago
  • 5.0.3                                ...           5 years ago
  • 5.0.2                                ...           5 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.17                                ...           6 years ago
  • 3.0.16                                ...           6 years ago
  • 3.0.15                                ...           6 years ago
  • 3.0.14                                ...           6 years ago
  • 3.0.13                                ...           6 years ago
  • 3.0.12                                ...           6 years ago
  • 3.0.11                                ...           6 years ago
  • 3.0.10                                ...           6 years ago
  • 3.0.9                                ...           6 years ago
  • 3.0.8                                ...           6 years ago
  • 3.0.7                                ...           6 years ago
  • 3.0.6                                ...           6 years ago
  • 3.0.5                                ...           6 years ago
  • 3.0.4                                ...           6 years ago
  • 3.0.3                                ...           6 years ago
  • 3.0.2                                ...           6 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.10                                ...           6 years ago
  • 2.0.9                                ...           6 years ago
  • 2.0.8                                ...           6 years ago
  • 2.0.7                                ...           7 years ago
  • 2.0.6                                ...           7 years ago
  • 2.0.5                                ...           7 years ago
  • 2.0.4                                ...           7 years ago
  • 2.0.3                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)

Copyright 2013 - present © cnpmjs.org | Home |