Skip to content

Commit

Permalink
Merge pull request #14 from ipfs/feat/decode-ls
Browse files Browse the repository at this point in the history
Expose a constructor for making a decoder with an existing link system
  • Loading branch information
willscott authored May 31, 2023
2 parents 80a5a44 + 5f81b34 commit 65060da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ func NewDecoder() *Decoder {
}
}

func NewDecoderWithLS(ls ipld.LinkSystem) *Decoder {
return &Decoder{
codecTable: map[uint64]codecConverter{},
linkSystemBase: ls,
}
}

// RegisterCodec registers a specialized prototype & converter for a specific codec
func (d *Decoder) RegisterCodec(codec uint64, prototype ipld.NodePrototype, converter NodeConverter) {
d.codecTable[codec] = codecConverter{prototype, converter}
Expand Down

0 comments on commit 65060da

Please sign in to comment.