Skip to content

fix(export): stream SQL, CSV, and JSON database dumps in paginated chunks - #321

Open
cocvn157 wants to merge 1 commit into
outerbase:mainfrom
cocvn157:fix/issue-59-streaming-database-dumps
Open

cocvn157 wants to merge 1 commit into
outerbase:mainfrom
cocvn157:fix/issue-59-streaming-database-dumps

Conversation

@cocvn157

@cocvn157 cocvn157 commented Nov 3, 2026

Copy link
Copy Markdown

Summary

Fixes memory exhaustion when exporting large databases via the SQL, CSV, and JSON dump endpoints (#59).

Changes

  • Refactored src/export/dump.ts, src/export/csv.ts, and src/export/json.ts to stream table rows in paginated chunks via ReadableStream rather than buffering the entire database into Cloudflare Worker memory at once.
  • Preserved backward-compatible array/string helpers where needed while wiring the HTTP dump endpoints (src/export/index.ts) directly to the streaming responses.
  • Added comprehensive unit tests (dump.test.ts, csv.test.ts, json.test.ts, index.test.ts) verifying multi-batch pagination, escaping, and empty/large table edge cases.

Fixes #59
/claim #59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database dumps do not work on large databases

1 participant