starbasedb
starbasedb copied to clipboard
fix: Support large database dumps with streaming and pagination
Fixes #59
Problem
Database dump endpoints load all data into memory. For >1GB databases, this causes memory exhaustion (128MB limit) and 30-second CPU timeout.
Changes
- Streaming: dump, JSON, CSV exports now use ReadableStream
- Pagination: SQL queries use LIMIT/OFFSET (500 rows/chunk)
- Memory safe: constant memory usage regardless of DB size
New endpoints
/export/json-stream/:tableName- streaming JSON/export/csv-stream/:tableName- streaming CSV
I have updated the PR to resolve several regressions found in the initial streaming implementation. Fixed a crash in the database dump route and updated the unit tests to match the new chunked/streaming behavior. All export-related tests are now passing locally.