shortshare

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 9 Imported by: 0

README

shortshare

Easy sharing of data using compression and encoding.

binary

This repository provides a single binary alongside the library functions, go get github.com/mtib/shortshare, then pipe into shortshare to generate shareable text, and pipe shared text into shortshare -u to decompress and decode.

library

It's pretty easy to figure out ;)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Share

func Share(data interface{}) (*bytes.Buffer, error)

Share converts the provided data into a sharable (base64 urlencoded) bytes.Buffer, it uses the datas json representation as an intermediary.

func ShareString

func ShareString(data interface{}) (string, error)

ShareString does the same as Share but converts the bytes.Buffer into a string.

func Unshare

func Unshare(data io.Reader, target interface{}) error

Unshare unmarshals the data into the target.

func UnshareString

func UnshareString(data string, target interface{}) error

UnshareString unmarshals the data string into the target.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder only provided in case you prefer this calling scheme to the imperative Share()

func NewDecoder

func NewDecoder(reader io.Reader) Decoder

NewDecoder creates a new Decoder which reads from the io.Reader and offers a Decode(target) method.

func (Decoder) Decode

func (d Decoder) Decode(target interface{}) error

Decode decodes the data the reader this Decoder was created with has into the target.

Jump to

Keyboard shortcuts

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