Skip to content

roman-kachanovsky/go-binary-pack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go BinaryPack

Build Status GoDoc

BinaryPack is a simple Golang library which implements some functionality of Python's struct package.

Install

go get github.com/roman-kachanovsky/go-binary-pack/binary-pack

How to use

// Prepare format (slice of strings)
format := []string{"I", "?", "d", "6s"}

// Prepare values to pack
values := []interface{}{4, true, 3.14, "Golang"}

// Create BinaryPack object
bp := new(BinaryPack)

// Pack values to []byte
data, err := bp.Pack(format, values)

// Unpack binary data to []interface{}
unpacked_values, err := bp.UnPack(format, data)

// You can calculate size of expected binary data by format
size, err := bp.CalcSize(format)

About

Golang implementation of Python's struct package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages