Skip to content

Commit 0ad3e13

Browse files
docs: document export events usage in README
1 parent 1d9b9a8 commit 0ad3e13

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,17 @@ To see the integration test coverage report open `.coverage/integration/lcov-rep
543543
open .coverage/integration/lcov-report/index.html
544544
```
545545
546+
## Export Events
547+
548+
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.
549+
550+
```
551+
npm run export # writes to events.jsonl
552+
npm run export -- backup-2024-01-01.jsonl # custom filename
553+
```
554+
555+
The script reads the same `DB_*` environment variables used by the relay (see [CONFIGURATION.md](CONFIGURATION.md)).
556+
546557
## Configuration
547558
548559
You can change the default folder by setting the `NOSTR_CONFIG_DIR` environment variable to a different path.

0 commit comments

Comments
 (0)