generate-csv-report
A script that builds a CSV report from API data using streaming and async iteration, then emails it as a rendered attachment.
Problem
Turn a list of records into a CSV file and deliver it by email without holding the whole dataset in memory.
Built with
- Node.js
- csv-parse
- csv-stringify
- nodemailer
- Handlebars
Architecture
Report pipeline
Inferred- API records Fetched user data
- Async generator Produces rows lazily
- CSV stream Serializes each row
- Email Sends the attachment
Evidence
A Csv class wraps csv-parse and csv-stringify with configurable options (BOM, headers, delimiter, quoting, escaping) and accepts either a file path or a stream, checking file access before reading.
Verifiedindex.js fetches users from the public jsonplaceholder API and builds CSV rows through an async generator, writing them both to output.csv and to a stream.
VerifiedThe report is emailed with nodemailer over the SendGrid transport, rendering html and text bodies from Handlebars templates that are compiled once and cached.
VerifiedreadFile.js and writeFile.js are ad-hoc scripts that exercise the Csv class with console.assert rather than a test runner.
VerifiedContribution
Sole developer
Owner-confirmed sole work
Owner-confirmed: sole, original work. Node streams / async-generator CSV report generation against a public demo API, emailed via nodemailer with Handlebars templates.