Skip to content

ljmsc/bx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1cb5d29 · Feb 15, 2022

History

12 Commits
Jun 13, 2021
Mar 14, 2021
Jun 13, 2021
Mar 14, 2021
May 27, 2021
Feb 15, 2022
Jun 13, 2021
Feb 12, 2022
Feb 15, 2022
May 27, 2021
Mar 14, 2021
Jun 13, 2021

Repository files navigation

bx

Go Report Card GoDoc

bx is a binary encoding/decoding lib for go.

Installation

The code was tested with go version 1.15. Older versions can also work but have not been tested.

go get -u github.com/ljmsc/bx

Usage

encoding

package main

import (
	"github.com/ljmsc/bx"
)

func main() {
	foo := "this is my test value string"
	bar := int64(1337)

	raw, err := bx.Encoder().String(foo).Int64(bar).Encode()
	if err != nil {
		// handle error
	}
	// do something with the encoded data
}

decoding

package main

import (
	"github.com/ljmsc/bx"
)

func main() {
	var raw []byte // some binary data

	dec := bx.Decoder(raw)
	foo, err := dec.String()
	if err != nil {
		// handle error
	}
	bar, err := dec.Int64()
	if err != nil {
		// handle error
	}

	// use foo and bar
}

License

The project (and all code) is licensed under the Mozilla Public License Version 2.0.

About

bx is a binary encoding lib for go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages