All Projects → kelindar → Binary

kelindar / Binary

Licence: mit
Generic and fast binary serializer for Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Binary

sirdez
Glorious Binary Serialization and Deserialization for TypeScript.
Stars: ✭ 20 (-76.74%)
Mutual labels:  encoding, serialization, binary, decoding
Pbf
A low-level, lightweight protocol buffers implementation in JavaScript.
Stars: ✭ 618 (+618.6%)
Mutual labels:  encoding, serialization, binary, decoding
Scodec
Scala combinator library for working with binary data
Stars: ✭ 709 (+724.42%)
Mutual labels:  encoding, binary, decoding
Bitmatch
A Rust crate that allows you to match, bind, and pack the individual bits of integers.
Stars: ✭ 82 (-4.65%)
Mutual labels:  encoding, binary, decoding
Phpasn1
A PHP library to encode and decode arbitrary ASN.1 structures using ITU-T X.690 encoding rules.
Stars: ✭ 136 (+58.14%)
Mutual labels:  encoding, binary, decoding
Ffmpeg Video Player
An FFmpeg and SDL Tutorial.
Stars: ✭ 149 (+73.26%)
Mutual labels:  encoding, decoding, codec
Jsonlab
JSONLab: a native JSON/UBJSON/MassagePack encoder/decoder for MATLAB/Octave
Stars: ✭ 202 (+134.88%)
Mutual labels:  encoding, serialization, decoding
sia
Sia - Binary serialisation and deserialisation
Stars: ✭ 52 (-39.53%)
Mutual labels:  encoding, serialization, binary
Bincode
A binary encoder / decoder implementation in Rust.
Stars: ✭ 1,100 (+1179.07%)
Mutual labels:  encoding, serialization, binary
Msgpack Rust
MessagePack implementation for Rust / msgpack.org[Rust]
Stars: ✭ 561 (+552.33%)
Mutual labels:  serialization, decoding
Go Geom
Package geom implements efficient geometry types for geospatial applications.
Stars: ✭ 456 (+430.23%)
Mutual labels:  encoding, decoding
Flac
Free Lossless Audio Codec
Stars: ✭ 593 (+589.53%)
Mutual labels:  encoding, decoding
Iguana
universal serialization engine
Stars: ✭ 481 (+459.3%)
Mutual labels:  serialization, binary
Hashids.net
A small .NET package to generate YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user.
Stars: ✭ 470 (+446.51%)
Mutual labels:  encoding, decoding
Encoding
Go package containing implementations of efficient encoding, decoding, and validation APIs.
Stars: ✭ 705 (+719.77%)
Mutual labels:  encoding, decoding
Fastbinaryencoding
Fast Binary Encoding is ultra fast and universal serialization solution for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift
Stars: ✭ 421 (+389.53%)
Mutual labels:  serialization, binary
Decodify
Detect and decode encoded strings, recursively.
Stars: ✭ 670 (+679.07%)
Mutual labels:  encoding, decoding
Anycodable
Type-erased wrappers for Encodable, Decodable, and Codable values
Stars: ✭ 811 (+843.02%)
Mutual labels:  encoding, decoding
Rust Multibase
Multibase in rust
Stars: ✭ 30 (-65.12%)
Mutual labels:  encoding, decoding
X509
A PHP library for X.509 public key certificates, attribute certificates, certification requests and certification path validation.
Stars: ✭ 27 (-68.6%)
Mutual labels:  encoding, decoding

Generic and Fast Binary Serializer for Go

This repository contains a fast binary packer for Golang, this allows to encode/decode arbtitrary golang data structures of variable size. Documentation can be found on https://godoc.org/github.com/Kelindar/binary.

This package extends support to arbitrary, variable-sized values by prefixing these values with their varint-encoded size, recursively. This was originally inspired by Alec Thomas's binary package, but I've reworked the serialization format and improved the performance and size. Here's a few notable features/goals of this binary package:

  • Zero-allocation encoding. I'm hoping to make the encoding to be as fast as possible, simply writing binary to the io.Writer without unncessary allocations.
  • Support for maps, arrays, slices, structs, primitive and nested types.
  • This is essentially a json.Marshal and json.Unmarshal drop-in replacement, I wanted this package to be simple to use and leverage the power of reflect package of golang.
  • The ints and uints are encoded using varint, making the payload small as possible.
  • Fast-paths encoding and decoding of []byte, as I've designed this package to be used for inter-broker message encoding for emitter.
  • Support for custom BinaryMarshaler and BinaryUnmarshaler for tighter packing control and built-in types such as time.Time.

Usage

To serialize a message, simply Marshal:

v := &message{
    Name:      "Roman",
    Timestamp: 1242345235,
    Payload:   []byte("hi"),
    Ssid:      []uint32{1, 2, 3},
}

encoded, err := binary.Marshal(v)

To deserialize, Unmarshal:

var v message
err := binary.Unmarshal(encoded, &v)

Disclaimer

This is not intended as a replacement for JSON or protobuf, this codec does not maintain any versioning or compatibility - and not intended to become one. The goal of this binary codec is to efficiently exchange binary data of known format between systems where you control both ends and both of them are written in Go.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].