Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.07 KB

README.md

File metadata and controls

34 lines (24 loc) · 1.07 KB

Sia

Build Status

Sia - Binary serialisation and deserialisation with built-in compression. You can consider Sia a strongly typed, statically typed domain specific binary language for constructing data. Sia preserves data types and supports custom ones.

Install

go get github.com/pouya-eghbali/go-sia

Basic Usage

To serialize multiple values, first create a sia object and then you can add values in order. Note that the order of adding values should be considered when you want to read them again.

Serializing:

rawByte := sia.New().
    AddUInt16(1234).
    AddString64("think simple, do simple!").
    Bytes()

Deserializing:

deserialized := sia.NewFromBytes(rawByte)
gotSampleUint16 := deserialized.ReadUInt16() // 1234
gotSampleString := deserialized.ReadString64() // think simple, do simple!

Note that sia can't handle serializing of arrays, so it will fall back to JSON marshal about them.