API Reference / decodePack · function
Function: decodePack()
function decodePack(bytes): ChebData;
Decode a binary (CPK1) Chebyshev pack into the same shape a JSON pack loads to, ready for EngineData. The coefficients are exact multiples of the pack's quantum, identical to the Python reference's decoding.
Parameters
| Parameter | Type | Description |
|---|---|---|
bytes | Uint8Array | The contents of a .cpk file. |
Returns
The pack: jd0, seg_days, scale, segments, and provenance.
Example
const bytes = new Uint8Array(await (await fetch("/data/mars_cheb.cpk")).arrayBuffer());
const data = { ...embeddedData, chebPacks: { mars: decodePack(bytes) } };