/ src / core / pack.ts
pack.ts
 1  /**
 2   * Pack into an 8-byte big-endian format.
 3   */
 4  export const packBigEndian = (value: number): string => {
 5    const bytes = new Array(8).fill(0);
 6    for (let i = 7; i >= 0; i--) {
 7      bytes[i] = value & 255;
 8      value >>= 8;
 9    }
10  
11    return String.fromCharCode(...bytes);
12  };