mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
24 lines
457 B
TypeScript
24 lines
457 B
TypeScript
import { Storages } from '@/storages.ts';
|
|
|
|
const store = await Storages.db();
|
|
|
|
console.warn('Exporting events...');
|
|
|
|
let count = 0;
|
|
|
|
for await (const msg of store.req([{}])) {
|
|
if (msg[0] === 'EOSE') {
|
|
break;
|
|
}
|
|
if (msg[0] === 'EVENT') {
|
|
console.log(JSON.stringify(msg[2]));
|
|
count++;
|
|
}
|
|
if (msg[0] === 'CLOSED') {
|
|
console.error('Database closed unexpectedly');
|
|
break;
|
|
}
|
|
}
|
|
|
|
console.warn(`Exported ${count} events`);
|
|
Deno.exit();
|