Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ipld/dag-cbor

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ipld/dag-cbor - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "@ipld/dag-cbor",
"version": "2.0.0",
"version": "2.0.1",
"description": "JS implementation of dag-cbor",

@@ -5,0 +5,0 @@ "scripts": {

@@ -5,13 +5,11 @@ # @ipld/dag-cbor

This is the *new* interface meant for use with `multiformats` and
This is the *new* interface meant for use by itself or with `multiformats` and
`@ipld/block`. It is not used by `js-ipld-format` which is currently
used in IPFS. That library is [here](https://github.com/ipld/js-ipld-dag-cbor).
Usage (w/ Block Interface):
Usage:
```javascript
const multiformats = require('multiformats/basics')
multiformats.add(require('@ipld/dag-cbor'))
const Block = require('@ipld/block')(multiformats)
const { CID } = multiformats
import { encode, decode } from '@ipld/dag-cbor'
import { CID } from 'multiformats'

@@ -21,5 +19,5 @@ const obj = {

/* CID instances are encoded as links */
y: [2, 3, CID.from('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')],
y: [2, 3, CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')],
z: {
a: CID.from('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'),
a: CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'),
b: null,

@@ -30,5 +28,4 @@ c: 'string'

let encoder = Block.encoder(obj, 'dag-json')
let encoded = await Block.encode() // binary encoded block
let decoded = await Block.decoder(encoded, 'dag-json').decode()
let data = encode(obj)
let decoded = decode(data)
decoded.y[0] // 2

@@ -35,0 +32,0 @@ CID.asCID(decoded.z.a) // cid instance

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc