Skip to content

Commit 21a85d6

Browse files
docs: add jsonl import usage to README
1 parent ae18173 commit 21a85d6

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,29 @@ Print the Tor hostname:
220220
./scripts/print_tor_hostname
221221
```
222222
223+
### Importing events from JSON Lines
224+
225+
You can import NIP-01 events from a `.jsonl` file directly into the relay database.
226+
227+
Basic import:
228+
```
229+
npm run import -- ./events.jsonl
230+
```
231+
232+
Set a custom batch size (default: `1000`):
233+
```
234+
npm run import -- ./events.jsonl --batch-size 500
235+
```
236+
237+
The importer:
238+
239+
- Processes the file line-by-line to keep memory usage bounded.
240+
- Validates NIP-01 schema, event id hash, and Schnorr signature before insertion.
241+
- Inserts in database transactions per batch.
242+
- Skips duplicates without failing the whole import.
243+
- Prints progress in the format:
244+
`[Processed: 50,000 | Inserted: 45,000 | Skipped: 5,000 | Errors: 0]`
245+
223246
### Running as a Service
224247
225248
By default this server will run continuously until you stop it with Ctrl+C or until the system restarts.

0 commit comments

Comments
 (0)