You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jDataView was around before BigInts existed! At the time, there was no option but to implement Int64 methods in a bespoke way.
Now, these methods are kept as helpful utilities. Be careful though, because they'll just return regular numbers, so you will lose precision when reading very large numbers.
Reference
See writeXXX methods to understand the write variants of the set methods.
getBigInt64(byteOffset: number |undefined,littleEndian?: boolean): bigintsetBigInt64(byteOffset: number |undefined,value: bigint,littleEndian?: boolean): voidwriteBigInt64(value: bigint,littleEndian?: boolean): voidgetBigUint64(byteOffset: number |undefined,littleEndian?: boolean): bigintsetBigUint64(byteOffset: number |undefined,value: bigint,littleEndian?: boolean): voidwriteBigUint64(value: bigint,littleEndian?: boolean): void
jDataView's extra methods
// Get a 64 bit integer. Returns a regular Number, not a BigInt.// For more precision, use `getBigInt64()`getInt64(byteOffset: number |undefined,littleEndian?: boolean): number// Sets a 64 bit integer. Takes a regular Number, not a BigInt.// For more precision, use `setBigInt64()`setInt64(byteOffset: number |undefined,value: number,littleEndian?: boolean): voidwriteInt64(value: number,littleEndian?: boolean): void// Get an unsigned 64 bit integer. Returns a regular Number, not a BigInt.// For more precision, use `getBigUint64()`getUint64(byteOffset: number |undefined,littleEndian?: boolean): number// Sets an unsigned 64 bit integer. Takes a regular Number, not a BigInt.// For more precision, use `setBigUint64()`setUint64(byteOffset: number |undefined,value: number,littleEndian?: boolean): voidwriteUint64(value: number,littleEndian?: boolean): void