diff --git a/cmd/tvx/stores.go b/cmd/tvx/stores.go index 0f4f81397..0c06aa83e 100644 --- a/cmd/tvx/stores.go +++ b/cmd/tvx/stores.go @@ -5,6 +5,8 @@ import ( "log" "sync" + "golang.org/x/xerrors" + "github.com/fatih/color" blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-blockservice" @@ -158,3 +160,12 @@ func (pb *proxyingBlockstore) PutMany(ctx context.Context, blocks []blocks.Block pb.lk.Unlock() return pb.Blockstore.PutMany(ctx, blocks) } + +func (pb *proxyingBlockstore) View(ctx context.Context, c cid.Cid, callback func([]byte) error) error { + blk, err := pb.Get(ctx, c) + if err != nil { + return xerrors.Errorf("failed to Get cid %s: %w", c, err) + } + + return callback(blk.RawData()) +}