···7070 const car = fromStream(stream);
71717272 try {
7373+ //This reads the repo as it is downloaded. which was very cool and I didn't know it would do that
7374 for await (const entry of car) {
7474-7575 let checkForCollection = collections.find(c => c.collection === entry.collection);
7676 if (!checkForCollection) {
7777 collections.push({ collection: entry.collection, count: 1 });
···105105 try {
106106 const rpc = new Client({ handler: simpleFetchHandler({ service: pdsUrl }) });
107107 startTimer();
108108+ //We can make a call to get a list of collections in the repo
108109 let describeRepo = await rpc.get('com.atproto.repo.describeRepo', {
109110 params: {
110111 repo: did
···114115 throw new Error(`HTTP error! status: ${describeRepo.status}`);
115116 }
116117 webCalls++;
118118+ //We go through each collection and get a list of records in it
117119 for (const collection of describeRepo.data.collections) {
118120 let totalRecordsInCollection = 0;
119121 currentCollection = collection;
122122+ //Do the first call to get a cursor
120123 const firstCollectionList = await rpc.get('com.atproto.repo.listRecords', {
121124 params: {
122125 collection,
···132135 totalRecordsInCollection += firstCollectionList.data.records.length;
133136134137 let cursor = firstCollectionList.data.cursor;
138138+ //Walk the collection till the cursor is undefined meaning no more records
135139 do {
136140 const nextCollectionList = await rpc.get('com.atproto.repo.listRecords', {
137141 params: {