base256

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2017 License: BSD-3-Clause Imports: 2 Imported by: 2

README ΒΆ

base256

Travis Coverage Status Release Go Report Card License GoDoc

πŸŒ€ Binary to emoji encoding.

Install

$ go get -u ekyu.moe/base256
# or better
$ dep ensure -add ekyu.moe/base256

Example

package main

import (
    "fmt"

    "ekyu.moe/base256"
)

func main() {
    fmt.Println(base256.EncodeToString([]byte("Hello, δΈ–η•Œ")))   //=> πŸ‘ΎπŸ§πŸ™†πŸ¬πŸ™‡πŸŒ±πŸ˜ŒπŸšŸπŸ’¦πŸ₯πŸ΄πŸ€πŸ‘ˆ
    fmt.Println(string(base256.DecodeString("πŸ‘ΎπŸ§πŸ™†πŸ¬πŸ™‡πŸŒ±πŸ˜ŒπŸšŸπŸ’¦πŸ₯πŸ΄πŸ€πŸ‘ˆ"))) //=> Hello, δΈ–η•Œ
}

Check godoc for further documents.

A CLI utility is also available with go get ekyu.moe/base256/cmd/base256.

Specification

base256 encoding uses two tables to transform a single byte into a single emoji. The tables can be found in table.go. In this implementation, these tables are utilized circularly when encoding, however such rule does not apply to decoding.

To achieve the best compatibility, all the emojis are picked from the classic version and each of them is 4 bytes long in UTF-8.

License

BSD-3-clause

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func DecodeString ΒΆ

func DecodeString(s string) []byte

DecodeString returns the bytes represented by the base256 string s. Non-base256 runes are skipped silently.

func EncodeToString ΒΆ

func EncodeToString(src []byte) string

EncodeToString returns the encoded base256 string of src.

func NewDecoder ΒΆ

func NewDecoder(r io.Reader) io.Reader

NewDecoder constructs a new base256 stream decoder. Data read from the returned reader is base256 decoded from r. Non-base256 runes are skipped silently.

func NewEncoder ΒΆ

func NewEncoder(w io.Writer) io.WriteCloser

NewEncoder returns a new base256 stream encoder. Data written to the returned writer will be encoded using base256 and then written to w. When finished writing, the caller must Close the returned encoder to flush any partially written blocks.

Types ΒΆ

This section is empty.

Directories ΒΆ

Path Synopsis
cmd
base256
base256: a cli utility for base256 encode/decode.
base256: a cli utility for base256 encode/decode.

Jump to

Keyboard shortcuts

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