msgpackr 1.7.0-alpha5 → 1.7.0-beta1
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/README.md +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +62 -62
- package/dist/index.min.js.map +1 -1
- package/dist/node.cjs +96 -35
- package/dist/node.cjs.map +1 -1
- package/dist/test.js +101 -36
- package/dist/test.js.map +1 -1
- package/package.json +1 -1
- package/struct.js +80 -32
- package/unpack.js +16 -4
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ stream.write(myData);
|
|
|
40
40
|
```
|
|
41
41
|
Or for a full example of sending and receiving data on a stream:
|
|
42
42
|
```js
|
|
43
|
-
import { PackrStream } from 'msgpackr';
|
|
43
|
+
import { PackrStream, UnpackrStream } from 'msgpackr';
|
|
44
44
|
let sendingStream = new PackrStream();
|
|
45
45
|
let receivingStream = new UnpackrStream();
|
|
46
46
|
// we are just piping to our own stream, but normally you would send and
|
package/dist/index.js
CHANGED
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
// else more to read, but we are reading sequentially, so don't clear source yet
|
|
203
203
|
return result
|
|
204
204
|
} catch(error) {
|
|
205
|
-
if (currentStructures
|
|
205
|
+
if (currentStructures?.restoreStructures)
|
|
206
206
|
restoreStructures();
|
|
207
207
|
clearSource();
|
|
208
208
|
if (error instanceof RangeError || error.message.startsWith('Unexpected end of buffer') || position > srcEnd) {
|
|
@@ -875,7 +875,16 @@
|
|
|
875
875
|
|
|
876
876
|
// the registration of the record definition extension (as "r")
|
|
877
877
|
const recordDefinition = (id, highByte) => {
|
|
878
|
-
|
|
878
|
+
let structure;
|
|
879
|
+
if (currentUnpackr.freezeData) {
|
|
880
|
+
currentUnpackr.freezeData = false;
|
|
881
|
+
try {
|
|
882
|
+
structure = read();
|
|
883
|
+
} finally {
|
|
884
|
+
currentUnpackr.freezeData = true;
|
|
885
|
+
}
|
|
886
|
+
} else
|
|
887
|
+
structure = read();
|
|
879
888
|
let firstByte = id;
|
|
880
889
|
if (highByte !== undefined) {
|
|
881
890
|
id = id < 32 ? -((highByte << 5) + id) : ((highByte << 5) + id);
|