Skip to content

Commit 7508ec5

Browse files
committed
Update
1 parent 8665c98 commit 7508ec5

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
# BinaryToJSON
2-
format binary data to JSON.
2+
A Deno module helper class that convert binary array buffer to JSON format.
3+
Binary interpretation is defined by JSON.
4+
5+
This module depends on https://deno.land/x/binary_reader@v0.1.6/mod.ts .
6+
7+
## Usage
8+
```typescript
9+
import { BinaryToJSON } from "./binary_to_json.ts";
10+
11+
const buffer = new ArrayBuffer(4);
12+
const arry = new Uint8Array(buffer);
13+
arry[0] = 0x0A;
14+
arry[1] = 0x0B;
15+
arry[2] = 0x0C;
16+
arry[3] = 0x0D;
17+
const format = [{"dat": 4}];
18+
const b2j = new BinaryToJSON();
19+
const data: any = b2j.convert(arry, format); // default endian is big
20+
21+
// => {"dat": 168496141 } # 0x0A0B0C0D
22+
```
23+
24+
25+
more info: please refer to test.ts.

0 commit comments

Comments
 (0)