You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate runtime logging to pino across adapters, services, workers, and controllers, and stabilize CI-related fixes for coverage and integration workflows after rebasing.
Copy file name to clipboardExpand all lines: README.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,13 +262,23 @@ Print the I2P hostname:
262
262
263
263
### Importing events from JSON Lines
264
264
265
-
You can import NIP-01 events from a `.jsonl` file directly into the relay database.
265
+
You can import NIP-01 events from `.jsonl` files directly into the relay database.
266
+
Compressed files are also supported and decompressed on-the-fly:
267
+
268
+
- `.jsonl.gz` (Gzip)
269
+
- `.jsonl.xz` (XZ)
266
270
267
271
Basic import:
268
272
```
269
273
npm run import -- ./events.jsonl
270
274
```
271
275
276
+
Import a compressed backup:
277
+
```
278
+
npm run import -- ./events.jsonl.gz
279
+
npm run import -- ./events.jsonl.xz
280
+
```
281
+
272
282
Set a custom batch size (default: `1000`):
273
283
```
274
284
npm run import -- ./events.jsonl --batch-size 500
@@ -652,16 +662,42 @@ To observe client and subscription counts in real-time during a test, you can in
652
662
```bash
653
663
docker compose logs -f nostream
654
664
```
655
-
656
665
## Export Events
657
666
658
667
Export all stored events to a [JSON Lines](https://jsonlines.org/) (`.jsonl`) file. Each line is a valid NIP-01 Nostr event JSON object. The export streams rows from the database using cursors, so it works safely on relays with millions of events without loading them into memory.
659
668
669
+
Optional compression is supported for lower storage and transfer costs:
670
+
671
+
- Gzip via Node's native `zlib`
672
+
- XZ via `lzma-native`
673
+
660
674
```
661
675
npm run export # writes to events.jsonl
662
676
npm run export -- backup-2024-01-01.jsonl # custom filename
677
+
npm run export -- backup.jsonl.gz --compress --format=gzip
678
+
npm run export -- backup.jsonl.xz --compress --format=xz
663
679
```
664
680
681
+
Flags:
682
+
683
+
-`--compress` / `-z`: enable compression.
684
+
-`--format <gzip|gz|xz>`: compression format. If omitted while compression is enabled,
685
+
format is inferred from file extension (`.gz` / `.xz`) and defaults to `gzip`.
686
+
687
+
After completion, the exporter prints a summary with:
688
+
689
+
- Raw bytes generated from JSONL lines
690
+
- Output bytes written to disk
691
+
- Compression delta (smaller/larger)
692
+
- Throughput in events/sec and bytes/sec
693
+
694
+
Optional XZ tuning (environment variables):
695
+
696
+
-`NOSTREAM_XZ_THREADS`: max worker threads for XZ compression.
697
+
Defaults to `4` and is automatically capped to available CPU cores minus one.
698
+
-`NOSTREAM_XZ_PRESET`: compression preset from `0` (fastest, larger output)
699
+
to `9` (slowest, smallest output). Default is `6`.
700
+
665
701
The script reads the same `DB_*` environment variables used by the relay (see [CONFIGURATION.md](CONFIGURATION.md)).
0 commit comments