⚡ Zero-dependency plcbundle library exclusively for Bun
1/**
2 * Example: Clone bundles from remote repository
3 *
4 * Usage:
5 * bun examples/clone.ts
6 */
7
8import { PLCBundle } from '../src';
9
10const bundle = new PLCBundle('./data/bundles');
11
12console.log('Starting clone...\n');
13
14await bundle.clone('https://plcbundle.atscan.net', {
15 bundles: '1-100', // Clone first 100 bundles
16 threads: 8, // Use 8 parallel downloads
17 verify: true, // Verify hashes
18 onProgress: (stats) => {
19 const percent = ((stats.downloadedBytes / stats.totalBytes) * 100).toFixed(1);
20 const mb = (stats.downloadedBytes / 1e6).toFixed(1);
21 const total = (stats.totalBytes / 1e6).toFixed(1);
22
23 process.stdout.write(
24 `Downloaded ${stats.downloadedBundles + stats.skippedBundles}/${stats.totalBundles} ` +
25 `| ${mb}/${total} MB (${percent}%)\r`
26 );
27 }
28});
29
30console.log('\n✓ Clone complete!');