Skip to content

Commit 74f9e71

Browse files
Update README.md
1 parent 091593f commit 74f9e71

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a tiny module to help you convert between JSON data and ArrayBuffer, and you can use it in both Node.js and browsers.
44

5-
## Feature
5+
## Features
66

77
* Convert JSON data to ArrayBuffer.
88
* Revert JSON data from ArrayBuffer.
@@ -15,19 +15,15 @@ npm install json-bufferify
1515

1616
## Usage
1717

18-
### Import json-bufferify.
18+
### Step 0 - Import json-bufferify.
1919

2020
__In Node.js__
2121

22-
CommonJS
23-
2422
```javascript
23+
// CommonJS
2524
const bufferify = require('json-bufferify');
26-
```
2725

28-
ES6 Modules
29-
30-
```javascript
26+
// ES6 Modules
3127
import bufferify from 'json-bufferify';
3228
```
3329

@@ -39,8 +35,12 @@ __In browsers__
3935

4036
__In TypeScript__
4137

42-
```javascript
38+
```typescript
39+
// Traditional style
4340
import bufferify = require('json-bufferify');
41+
42+
// ES6 Modules
43+
import bufferify from 'json-bufferify';
4444
```
4545

4646
__In Egret__
@@ -54,7 +54,7 @@ Open "egretProperties.json" and Add the following code to "modules" node.
5454
}
5555
```
5656

57-
### Convert JSON data to ArrayBuffer and send via WebSocket.
57+
### Step 1 - Convert JSON data to ArrayBuffer and send via WebSocket.
5858

5959
```javascript
6060
let ws = new WebSocket(url);
@@ -66,7 +66,7 @@ ws.send(bufferify.encode(0, {
6666
}));
6767
```
6868

69-
### Revert JSON data from ArrayBuffer.
69+
### Step 2 - Revert JSON data from ArrayBuffer.
7070

7171
```javascript
7272
ws.on('message', data => {
@@ -78,7 +78,7 @@ ws.on('message', data => {
7878
});
7979
```
8080

81-
## API
81+
## APIs
8282

8383
### bufferify.encode(offset, data)
8484

@@ -95,7 +95,7 @@ Revert JSON data from ArrayBuffer and return it.
9595
* `template` - The template of the JSON data.
9696
* `source` - The ArrayBuffer, or the Buffer in Node.js, or the DataView of the ArrayBuffer.
9797

98-
## Example
98+
## Examples
9999

100100
### Convert/Revert an array.
101101

0 commit comments

Comments
 (0)