Audit CSV Stream Handler
Component Detail
Infrastructure
medium complexity
backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Streaming response handler for CSV export of audit log entries. Uses Node.js async iteration to pipe database cursor output directly to the HTTP response, preventing memory exhaustion on large organizations with high audit volumes.
audit-csv-stream-handler
Sources & reasoning
CSV export uses streaming to avoid memory limits on large organizations with high audit volumes, as explicitly noted in implementation notes. A dedicated infrastructure handler isolates the streaming concern from the AuditLogService business logic.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Open a server-side database cursor for the filtered audit log query
- Stream rows as CSV chunks directly to the HTTP response
- Set appropriate Content-Disposition and Content-Type headers
- Handle back-pressure and connection drops gracefully
Interfaces
streamCsvExport(res: ServerResponse, filters: AuditFilters): Promise<void>