⚡ Zero-dependency plcbundle library exclusively for Bun
1/**
2 * Example: Verify integrity of downloaded bundles
3 *
4 * Usage:
5 * bun examples/verify.ts
6 */
7
8import { PLCBundle } from '../src';
9
10const bundle = new PLCBundle('./data/bundles');
11
12console.log('Verifying bundles...\n');
13
14const stats = await bundle.getStats();
15let valid = 0;
16let invalid = 0;
17
18for (let i = 1; i <= Math.min(10, stats.lastBundle); i++) {
19 const result = await bundle.verifyBundle(i);
20
21 if (result.valid) {
22 console.log(`✓ Bundle ${i} - valid`);
23 valid++;
24 } else {
25 console.log(`✗ Bundle ${i} - INVALID`);
26 result.errors.forEach(e => console.log(` ${e}`));
27 invalid++;
28 }
29}
30
31console.log(`\n${valid} valid, ${invalid} invalid`);