aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBiSaXa <1669855+BiSaXa@users.noreply.github.com>2022-09-04 14:53:07 +0300
committerBiSaXa <1669855+BiSaXa@users.noreply.github.com>2022-09-04 14:53:07 +0300
commita08480e8cd5df93a953323b400914520d5963660 (patch)
tree964a157eb318d544967e8e20e42dd7c7526dc0c4 /README.md
parentspecify little endian, easier reader construct (diff)
downloadbitreader-a08480e8cd5df93a953323b400914520d5963660.tar.gz
bitreader-a08480e8cd5df93a953323b400914520d5963660.tar.bz2
bitreader-a08480e8cd5df93a953323b400914520d5963660.zip
added skipbytes, 64 bit support for readbits, new readme
Diffstat (limited to 'README.md')
-rw-r--r--README.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md
index a493a1f..4f28e7b 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,38 @@
1# BitReader 1# BitReader
2A simple bit reader with big/little-endian support for golang.\
3Reads data from an existing byte array.\
4Uses string manipulation (for now).\
5Support reading up to 64 bits at one time.\
6Checking for overflowing the data.
7
8## Installation
9```bash
10$ go get github.com/bisaxa/bitreader
11```
12
13## Usage
14
15```go
16import "github.com/bisaxa/bitreader"
17
18// data: []byte Data to read from byte array
19// le: bool Little-endian(true) or big-endian(false) state
20reader := bitreader.Reader(data, le)
21
22// read first bit
23state, err := reader.ReadBit()
24
25// skip bits/bytes
26err := reader.SkipBits(8)
27err := reader.SkipBytes(4)
28
29// read bits
30value, err := reader.ReadBits(11)
31value, err := reader.ReadBits(64) // up to 64 bits
32```
33
34## Error Handling
35ReadBits(x), ReadBit(), SkipBits(x) and SkipBytes(x) functions returns an error message when they don't work as expected. It is advised to always handle errors.
36
37## License
38This project is licensed under [MIT License](LICENSE). \ No newline at end of file