package base64

import "github.com/segmentio/asm/base64"

Index

Constants

const (
	StdPadding rune = base64.StdPadding
	NoPadding  rune = base64.NoPadding
)

Variables

var RawStdEncoding = StdEncoding.WithPadding(NoPadding)

RawStdEncoding is the standard unpadded base64 encoding defined in RFC 4648 section 3.2. This is the same as StdEncoding but omits padding characters.

var RawURLEncoding = URLEncoding.WithPadding(NoPadding)

RawURLEncoding is the unpadded alternate base64 encoding defined in RFC 4648. This is the same as URLEncoding but omits padding characters.

var StdEncoding = NewEncoding(encodeStd)

StdEncoding is the standard base64 encoding, as defined in RFC 4648.

var URLEncoding = NewEncoding(encodeURL)

URLEncoding is the alternate base64 encoding defined in RFC 4648. It is typically used in URLs and file names.

Types

type Encoding

type Encoding = base64.Encoding

An Encoding is a radix 64 encoding/decoding scheme, defined by a 64-character alphabet.

func NewEncoding

func NewEncoding(encoder string) *Encoding

NewEncoding returns a new padded Encoding defined by the given alphabet, which must be a 64-byte string that does not contain the padding character or CR / LF ('\r', '\n'). Unlike the standard library, the encoding alphabet cannot be abitrary, and it must follow one of the know standard encoding variants.

Required alphabet values:

Flexible alphabet value options:

The resulting Encoding uses the default padding character ('='), which may be changed or disabled via WithPadding. The padding characters is urestricted, but it must be a character outside of the encoder alphabet.

Source Files

base64.go base64_default.go

Version
v1.1.1
Published
Nov 13, 2021
Platform
js/wasm
Imports
1 packages
Last checked
1 hour ago

Tools for package owners.