@nnilky/structo 1.0.3 → 1.0.4
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/dist/write.js +5 -7
- package/package.json +1 -1
package/dist/write.js
CHANGED
|
@@ -20,8 +20,8 @@ export function createdWriterContext(type) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
let bufferLength =
|
|
24
|
-
let buffer = new ArrayBuffer(bufferLength
|
|
23
|
+
let bufferLength = 64;
|
|
24
|
+
let buffer = new ArrayBuffer(bufferLength);
|
|
25
25
|
const view = new DataView(buffer);
|
|
26
26
|
return {
|
|
27
27
|
offset: 0,
|
|
@@ -30,11 +30,9 @@ export function createdWriterContext(type) {
|
|
|
30
30
|
alloc(length) {
|
|
31
31
|
if (length < 0)
|
|
32
32
|
return;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
bufferLength = bufferLength * 2;
|
|
37
|
-
this.buffer.resize(bufferLength);
|
|
33
|
+
while (this.offset + length >= bufferLength) {
|
|
34
|
+
bufferLength = this.buffer.byteLength * 2;
|
|
35
|
+
this.buffer = this.buffer.transfer(bufferLength);
|
|
38
36
|
this.view = new DataView(this.buffer);
|
|
39
37
|
}
|
|
40
38
|
},
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A library for serializing and deserializing binary content",
|
|
4
4
|
"keywords": ["binary", "library", "utility", "web", "node"],
|
|
5
5
|
"license": "ISC",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.4",
|
|
7
7
|
"author": "Ben Brady",
|
|
8
8
|
"private": false,
|
|
9
9
|
"publishConfig": {"access": "public"},
|