base64

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 6 Imported by: 0

README

base64

base64 defines base64 encoding & decoding functions, often used to represent binary as text.

Functions

encode(src,encoding="standard") string

return the base64 encoding of src

Parameters
name type description
src string source string to encode to base64
encoding string optional. string to set encoding dialect. allowed values are: standard,standard_raw,url,url_raw
Examples

basic

encode a string as base64

load("base64", "encode")
encoded = encode("hello world!")
print(encoded)
# Output: aGVsbG8gd29ybGQh
decode(src,encoding="standard") string

parse base64 input, giving back the plain string representation

Parameters
name type description
src string source string of base64-encoded text
encoding string optional. string to set decoding dialect. allowed values are: standard,standard_raw,url,url_raw
Examples

basic

encode a string as base64

load("base64", "decode")
decoded = decode("aGVsbG8gd29ybGQh")
print(decoded)
# Output: hello world!

Documentation

Overview

Package base64 defines base64 encoding & decoding functions for Starlark.

Migrated from: https://github.com/qri-io/starlib/tree/master/encoding/base64

Index

Constants

View Source
const ModuleName = "base64"

ModuleName defines the expected name for this Module when used in starlark's load() function, eg: load('base64', 'encode')

Variables

View Source
var Encodings = map[string]*gobase64.Encoding{

	"standard": gobase64.StdEncoding,

	"standard_raw": gobase64.RawStdEncoding,

	"url": gobase64.URLEncoding,

	"url_raw": gobase64.RawURLEncoding,
}

Encodings is a map of strings to encoding formats. It is used to select the encoding format for the base64 module. You can add your own encoding formats to this map.

Functions

func LoadModule

func LoadModule() (starlark.StringDict, error)

LoadModule loads the base64 module. It is concurrency-safe and idempotent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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