base64dec

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package base64dec contains a universal base64 decoder that works on both the standard and url-safe variants, padded and raw. The code is based on the standard encoding/base64 package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase64

func DecodeBase64[T ByteSeq](dst []byte, src T) (n int, err error)

DecodeBase64 decodes src and writes at most base64.RawStdEncoding.DecodedLen(len(src)) bytes to dst and returns the number of bytes written. If src contains invalid base64 data, it will return the number of bytes successfully written and base64.CorruptInputError. New line characters (\r and \n) are ignored. The input can be in the standard or the alternate (aka url-safe) encoding. It can be padded or un-padded. If there is a correct padding, it is consumed and no error is returned. If there is no padding where it's required, no error is returned. If there is an incorrect padding (i.e. too many or too few characters) it is treated as garbage at the end (i.e. the error will point to the first padding character).

Types

type ByteSeq

type ByteSeq interface {
	[]byte | string
}

Jump to

Keyboard shortcuts

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