From 5f81b344c30ef9c7cac29e39759b36f55ea3b203 Mon Sep 17 00:00:00 2001 From: Will Scott Date: Wed, 31 May 2023 08:29:24 -0700 Subject: [PATCH] Expose a constructor for making a decoder with an existing link system --- decode.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/decode.go b/decode.go index f8fdbc2..fea5603 100644 --- a/decode.go +++ b/decode.go @@ -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}