go-multibase icon indicating copy to clipboard operation
go-multibase copied to clipboard

Streaming multibase decoder

Open lidel opened this issue 4 years ago • 1 comments

Enhancement idea by @gammazero (extracted from https://github.com/ipfs/go-ipfs/pull/8180#discussion_r671549022):

Would it be worth implementing a multibase Decoder that would take an io.Reader and return one as well, with a signature like NewDecoder(io.Reader) io.Reader

Then [ipfs multibase decode <file>] could all be done without having to read the entire file into memory.

decReader := mbase.NewDecoder(file)
return resp.emit(decReader)

@lidel Seems like this is something that should exist, or am I missing an obvious reason it does not? Seems like a NewDecode function could start reading the stream, and then construct the correct decoder and return it as an io.Reader.

lidel avatar Aug 11 '21 22:08 lidel

FYI, I have a partial implementation at https://github.com/multiformats/go-multibase/compare/master...MichaelMure:go-multibase:encode-writer

But then I stumbled on https://github.com/multiformats/go-multibase/issues/62

MichaelMure avatar Oct 08 '24 14:10 MichaelMure