From cc8e177d9d7c386512d64aab46bf9b4568fc28d8 Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Mon, 27 Nov 2023 13:30:00 -0700 Subject: [PATCH] Document useBigIntExtension --- README.md | 1 + index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index be352a1..bf45d30 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ The following options properties can be provided to the Packr or Unpackr constru * `useTimestamp32` - Encode JS `Date`s in 32-bit format when possible by dropping the milliseconds. This is a more efficient encoding of dates. You can also cause dates to use 32-bit format by manually setting the milliseconds to zero (`date.setMilliseconds(0)`). * `sequential` - Encode structures in serialized data, and reference previously encoded structures with expectation that decoder will read the encoded structures in the same order as encoded, with `unpackMultiple`. * `largeBigIntToFloat` - If a bigint needs to be encoded that is larger than will fit in 64-bit integers, it will be encoded as a float-64 (otherwise will throw a RangeError). +* `useBigIntExtension` - If a bigint needs to be encoded that is larger than will fit in 64-bit integers, it will be encoded using a custom extension that supports up to about 1000-bits of integer precision. * `encodeUndefinedAsNil` - Encodes a value of `undefined` as a MessagePack `nil`, the same as a `null`. * `int64AsType` - This will decode uint64 and int64 numbers as the specified type. The type can be `bigint` (default), `number`, `string`, or `auto` (where range [-2^53...2^53] is represented by number and everything else by a bigint). * `onInvalidDate` - This can be provided as function that will be called when an invalid date is provided. The function can throw an error, or return a value that will be encoded in place of the invalid date. If not provided, an invalid date will be encoded as an invalid timestamp (which decodes with msgpackr back to an invalid date). diff --git a/index.d.ts b/index.d.ts index 01f7f71..ce690f1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -19,6 +19,7 @@ export interface Options { bundleStrings?: boolean useTimestamp32?: boolean largeBigIntToFloat?: boolean + useBigIntExtension?: boolean encodeUndefinedAsNil?: boolean maxSharedStructures?: number maxOwnStructures?: number