base64toraw

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 1 Imported by: 1

README

base64toraw

v0.0.1 : 25 January 2025

Details

package base64translator is a very simple translator for taking either base64.StdEncoded data to base64.RawStdEncoded to allow both to be read by base64.RawStdEncoding decoding.

This is best used in cases where you aren't sure whether you will be receiving base64.StdEncoded or base64.RawStdEncoded data.

Usage example:

b64 := NewBase64ToRaw(bytes.NewReader(encodedBytes))
b, err := io.ReadAll(base64.NewDecoder(base64.RawStdEncoding, b64))

Licence

This project is licensed under the MIT Licence.

Documentation

Overview

package base64translator translates base64.StdEncoded data to base64.RawStdEncoded to allow both to be read by base64.RawStdEncoding decoding.

For example:

b64 := NewBase64ToRaw(bytes.NewReader(encodedBytes))
b, err := io.ReadAll(base64.NewDecoder(base64.RawStdEncoding, b64))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base64ToRaw

type Base64ToRaw struct {
	// contains filtered or unexported fields
}

Base64ToRaw translates base64.StdEncoded into base64.RawStdDecoded data.

func NewBase64ToRaw

func NewBase64ToRaw(r io.Reader) *Base64ToRaw

func (*Base64ToRaw) Read

func (b *Base64ToRaw) Read(p []byte) (int, error)

Read is basically the same as encoding/base64/base64.go with the addition of skipping the '=' rune.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL