+4
-6
src/lib/RepoStats.svelte
+4
-6
src/lib/RepoStats.svelte
···
2
2
import { onMount } from 'svelte';
3
3
import { Client, simpleFetchHandler } from '@atcute/client';
4
4
import type {} from '@atcute/atproto';
5
-
import { repoEntryTransform } from '@atcute/repo';
5
+
import { fromStream } from '@atcute/repo';
6
6
7
7
const { did, handle, pdsUrl, slowPokeMode } = $props();
8
8
···
65
65
if (!result.ok) {
66
66
throw new Error(`HTTP error! status: ${result.status}`);
67
67
}
68
-
69
-
const { readable, writable } = repoEntryTransform();
70
-
//Don't want to await so we can read as it streams
71
-
result.data.pipeTo(writable);
68
+
const repo = fromStream(result.data);
72
69
73
70
try {
74
71
//This reads the repo as it is downloaded. which was very cool and I didn't know it would do that
75
-
for await (const entry of readable) {
72
+
for await (const entry of repo) {
76
73
// record here is the content of the atproto record
77
74
// console.log(entry.record);
78
75
let checkForCollection = collections.find(c => c.collection === entry.collection);
···
90
87
loading = false;
91
88
} catch (err) {
92
89
stopTimer();
90
+
console.log(err);
93
91
console.error('Error fetching repo stats:', err);
94
92
if (err instanceof Error) {
95
93
error = err.message;