base64

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0, MIT Imports: 2 Imported by: 0

README

Base64

base64 provides an easy way to encode and decode base64 strings from within GopherLua

Installation

go get github.com/zalando/skipper/script/base64

Usage

package main

import "github.com/yuin/gopher-lua"
import "github.com/zalando/skipper/script/base64"

var script string = `
local base64 = require("base64")

data, err = base64.decode("dXNlcjpwYXNzd29yZA==")
if err ~= nil then
    error(err)
else
    print("DATA="..data)
end
print("ENC="..base64.encode(data))
`


func main() {
    L := lua.NewState()
    defer L.Close()

    L.PreloadModule("base64", base64.Loader)

    if err := L.DoString(script); err != nil {
        panic(err)
    }
}

API

base64.decode(str)

Decodes the base64 encoded string. Returns the decoded string or (nil, error message).

base64.encode(str)

Returns the base64 encoded str.

Documentation

Overview

Package base64 provides an easy way to encode and decode base64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loader

func Loader(L *lua.LState) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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