multiformats/go-multibase

Function to tell what base a string is in.

Opened this issue · 0 comments

Would be great to have:

// StringBase returns the Base s is in.
func StringBase(s string) Base { ... }

// BufferBase returns the Base buf is in.
func BufferBase(buf []byte) Base { ... }

maybe even

type EncodedReader struct {
  R io.Reader // the underlying reader
  B Base // the base the reader is in
}

func NewEncodedReader(r io.Reader) EncodedReader {
  b := consumeTheBaseCode(r)
  return EncodedReader{r, b}
}

func (er *EncodedReader) Decoded() io.Reader {
  // return a reader that returns the decoded data
}