⚡ Zero-dependency plcbundle library exclusively for Bun
at main 594 B view raw
1/** 2 * Example: Stream operations from bundles 3 * 4 * Usage: 5 * bun examples/stream.ts 6 */ 7 8import { PLCBundle } from '../src'; 9 10const bundle = new PLCBundle('./data/bundles'); 11 12console.log('Streaming operations from bundle 1...\n'); 13 14let count = 0; 15const dids = new Set<string>(); 16 17for await (const op of bundle.streamOperations(1)) { 18 count++; 19 dids.add(op.did); 20 21 // Example: Print first 10 operations 22 if (count <= 10) { 23 console.log(`${count}. ${op.did} - ${op.createdAt}`); 24 } 25} 26 27console.log(`\n✓ Processed ${count} operations`); 28console.log(` Unique DIDs: ${dids.size}`);