bin-serde 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +7 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -157,6 +157,13 @@ export class Writer {
|
|
|
157
157
|
return this.bytes.subarray(0, this.pos);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
reset(): this {
|
|
161
|
+
this.pos = 0;
|
|
162
|
+
this.bytes = allocFromSlab(this.bytes.length);
|
|
163
|
+
this._view = null;
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
|
|
160
167
|
get size(): number {
|
|
161
168
|
return this.pos;
|
|
162
169
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -138,6 +138,12 @@ export class Writer {
|
|
|
138
138
|
toBuffer() {
|
|
139
139
|
return this.bytes.subarray(0, this.pos);
|
|
140
140
|
}
|
|
141
|
+
reset() {
|
|
142
|
+
this.pos = 0;
|
|
143
|
+
this.bytes = allocFromSlab(this.bytes.length);
|
|
144
|
+
this._view = null;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
141
147
|
get size() {
|
|
142
148
|
return this.pos;
|
|
143
149
|
}
|