Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1x 1x 1x 2x 2x 1x 1x | /**
* @module scripts/statskontoret/parsers/csv-zip
* @description CSV-in-ZIP archive parser for Statskontoret CSV download bundles.
*
* Returns an entry-name → CSV-text map preserving original archive names so
* downstream code can rely on Statskontoret's `Inkomst.csv` / `Utgift.csv`
* naming convention.
*
* @author Hack23 AB
* @license Apache-2.0
*/
import JSZip from 'jszip';
export async function parseStatskontoretCsvZip(
input: ArrayBuffer | Uint8Array,
): Promise<Record<string, string>> {
const zip = await JSZip.loadAsync(input);
const out: Record<string, string> = {};
for (const [name, entry] of Object.entries(zip.files)) {
Iif (entry.dir) continue;
if (!/\.csv$/i.test(name)) continue;
out[name] = await entry.async('string');
}
return out;
}
|