You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dynamic storage size buffer object based on Node.js builtin [`Buffer`](https://nodejs.org/api/buffer.html).
10
+
An automatically resizing storage size buffer type for Node.js that is based on Node.js builtin [`Buffer`](https://nodejs.org/api/buffer.html).
11
11
12
12
## Installation
13
13
@@ -67,6 +67,8 @@ yarn add dynamic-buffer
67
67
68
68
-[Write Data](#write-data)
69
69
70
+
-[Read Data](#read-data)
71
+
70
72
-[Iteration](#iteration)
71
73
72
74
-[Search](#search)
@@ -75,7 +77,7 @@ yarn add dynamic-buffer
75
77
76
78
-[Export Data](#export-data)
77
79
78
-
-[APIs](#apis)
80
+
-[Utils](#utils)
79
81
80
82
-[Run Tests](#run-tests)
81
83
@@ -113,6 +115,17 @@ console.log(buf.toString());
113
115
// Hello Node.js
114
116
```
115
117
118
+
### Read Data
119
+
120
+
You can access the byte at the specified position in the buffer by `read` or `at` methods:
121
+
122
+
```ts
123
+
const buf =newDynamicBuffer('Hello world');
124
+
125
+
buf.at(0); // 72
126
+
buf.read(1); // 101
127
+
```
128
+
116
129
### Iteration
117
130
118
131
`DynamicBuffer` provides three ways to iterate data from the specified buffer, you can use them with `for...of` statement.
@@ -147,7 +160,7 @@ console.log(buf.toString());
147
160
148
161
-`keys()` returns an iterator of buffer keys (indices).
149
162
150
-
## Search
163
+
###Search
151
164
152
165
You can search a value in the buffer by `indexOf` or `lastIndexOf`, and get the position of the first/last occurrence in the buffer. The searching value can be a string, a number, a `Buffer`, an `Uint8Array`, or another `DynamicBuffer`.
0 commit comments