msgpackr 1.11.12 → 2.0.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/README.md CHANGED
@@ -353,6 +353,22 @@ msgpackr saves all JavaScript `Date`s using the standard MessagePack date extens
353
353
  ### Structured Cloning
354
354
  With structured cloning enabled, msgpackr will also use extensions to store Set, Map, Error, RegExp, ArrayBufferView objects and preserve their types.
355
355
 
356
+ ## Upgrading to 2.0
357
+
358
+ msgpackr 2.0 removes the `randomAccessStructure` option and the internal `struct.js` module that implemented random-access struct encoding. This feature was previously undocumented and intended for internal use.
359
+
360
+ If you were using `randomAccessStructure: true`, the functionality is now available as the standalone [`structon`](https://github.com/HarperFast/structon) package. Structon provides the same random-access encoding with a more explicit API:
361
+
362
+ ```js
363
+ import { Packr } from 'msgpackr';
364
+ import { createStructon } from 'structon';
365
+
366
+ const Structon = createStructon(Packr);
367
+ const codec = new Structon({ structures: [] });
368
+ ```
369
+
370
+ Data encoded with `randomAccessStructure: true` in earlier msgpackr versions is fully readable by structon, and vice versa—the binary format is identical.
371
+
356
372
  ## Alternate Encoding/Package
357
373
  The high-performance serialization and deserialization algorithms in the msgpackr package are also available in the [cbor-x](https://github.com/kriszyp/cbor-x) for the CBOR format, with the same API and design. A quick summary of the pros and cons of using MessagePack vs CBOR are:
358
374
  * MessagePack has wider adoption, and, at least with this implementation is slightly more efficient (by roughly 1%).