bin-serde 1.1.0 → 1.1.1
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 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -4,8 +4,13 @@ const { pack, unpack } = (utf8 as any).default ?? utf8;
|
|
|
4
4
|
|
|
5
5
|
export class Writer {
|
|
6
6
|
private pos = 0;
|
|
7
|
-
private view
|
|
8
|
-
private bytes
|
|
7
|
+
private view: DataView;
|
|
8
|
+
private bytes: Uint8Array;
|
|
9
|
+
|
|
10
|
+
public constructor() {
|
|
11
|
+
this.view = new DataView(new ArrayBuffer(64));
|
|
12
|
+
this.bytes = new Uint8Array(this.view.buffer);
|
|
13
|
+
}
|
|
9
14
|
|
|
10
15
|
public writeUInt8(val: number) {
|
|
11
16
|
this.ensureSize(1);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -6,8 +6,12 @@ const utf8_buffer_size_1 = require("utf8-buffer-size");
|
|
|
6
6
|
const { pack, unpack } = utf8.default ?? utf8;
|
|
7
7
|
class Writer {
|
|
8
8
|
pos = 0;
|
|
9
|
-
view
|
|
10
|
-
bytes
|
|
9
|
+
view;
|
|
10
|
+
bytes;
|
|
11
|
+
constructor() {
|
|
12
|
+
this.view = new DataView(new ArrayBuffer(64));
|
|
13
|
+
this.bytes = new Uint8Array(this.view.buffer);
|
|
14
|
+
}
|
|
11
15
|
writeUInt8(val) {
|
|
12
16
|
this.ensureSize(1);
|
|
13
17
|
this.view.setUint8(this.pos, val);
|