⚡ Zero-dependency plcbundle library exclusively for Bun
at main 1.1 kB view raw
1/** 2 * Example: Get repository information 3 * 4 * Usage: 5 * bun examples/info.ts 6 */ 7 8import { PLCBundle } from '../src'; 9 10const bundle = new PLCBundle('./data/bundles'); 11 12const stats = await bundle.getStats(); 13 14console.log('📦 Repository Information\n'); 15console.log(`Version: ${stats.version}`); 16console.log(`Last bundle: ${stats.lastBundle}`); 17console.log(`Total bundles: ${stats.totalBundles}`); 18console.log(`Total size: ${(stats.totalSize / 1e9).toFixed(2)} GB`); 19console.log(`Updated: ${stats.updatedAt}`); 20 21console.log('\n📊 Sample Bundle Info\n'); 22 23const metadata = await bundle.getMetadata(1); 24if (metadata) { 25 console.log(`Bundle #${metadata.bundle_number}`); 26 console.log(` Operations: ${metadata.operation_count.toLocaleString()}`); 27 console.log(` Unique DIDs: ${metadata.did_count.toLocaleString()}`); 28 console.log(` Time range: ${metadata.start_time}${metadata.end_time}`); 29 console.log(` Size: ${(metadata.compressed_size / 1e6).toFixed(2)} MB (compressed)`); 30 console.log(` Size: ${(metadata.uncompressed_size / 1e6).toFixed(2)} MB (uncompressed)`); 31}