b64

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(forURL, noPadding bool, r io.Reader, w io.Writer) error

Decode outputs raw data from base64 encoding string.

Example
package main

import (
	"bytes"
	"fmt"
	"strings"

	"github.com/goark/gnkf/b64"
)

func main() {
	input := strings.NewReader("SGVsbG8gV29ybGQK")
	output := &bytes.Buffer{}
	if err := b64.Decode(false, false, input, output); err != nil {
		fmt.Println(err)
		return
	}
	fmt.Print(output.String())
}
Output:

Hello World

func Encode

func Encode(forURL, noPadding bool, r io.Reader, w io.Writer) error

Encode outputs base64 encoding string from raw data.

Example
package main

import (
	"bytes"
	"fmt"
	"strings"

	"github.com/goark/gnkf/b64"
)

func main() {
	input := strings.NewReader("Hello World\n")
	output := &bytes.Buffer{}
	if err := b64.Encode(false, false, input, output); err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(output.String())
}
Output:

SGVsbG8gV29ybGQK

Types

This section is empty.

Jump to

Keyboard shortcuts

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