Skip to content

Commit

Permalink
docs: point people at go-multicodec
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Mar 31, 2022
1 parent 6ca2617 commit 85198b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ fmt.Println("Got CID: ", c)
#### Creating a CID from scratch

```go

import (
cid "github.com/ipfs/go-cid"
mc "github.com/multiformats/go-multicodec"
mh "github.com/multiformats/go-multihash"
)

// Create a cid manually by specifying the 'prefix' parameters
pref := cid.Prefix{
Version: 1,
Codec: cid.Raw,
Codec: mc.Raw,
MhType: mh.SHA2_256,
MhLength: -1, // default length
}
Expand Down
9 changes: 5 additions & 4 deletions cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ var (
ErrInvalidEncoding = errors.New("invalid base encoding")
)

// These are multicodec-packed content types. The should match
// the codes described in the authoritative document:
// https://github.com/multiformats/multicodec/blob/master/table.csv
// Consts below are DEPRECATED and left only for legacy reasons:
// <https://github.com/ipfs/go-cid/pull/137>
// Modern code should use consts from go-multicodec instead:
// <https://github.com/multiformats/go-multicodec>
const (
// core IPLD
// common ones
Raw = 0x55
DagProtobuf = 0x70 // https://ipld.io/docs/codecs/known/dag-pb/
DagCBOR = 0x71 // https://ipld.io/docs/codecs/known/dag-cbor/
Expand Down

0 comments on commit 85198b9

Please sign in to comment.