express-csv
express-csv copied to clipboard
custom name to csv file?
I'm sure you've probably already figured it out, but before sending the data, set the header and content-type. This is a snippet of how I accomplished it:
res.setHeader('Content-disposition', 'attachment; filename=organization-report.csv');
res.set('Content-Type', 'text/csv');
I hope that helps.
how about the Unicode character? I stored some Chinese character in DB. When downloading the CSV and open with Excel. All the character will display some unexpected character like "ä½ å¥½å‘€ï¼Œæˆ‘ä¿‚æ˜Ÿå±•éŠ€è¡Œå˜…æ™ºèƒ½å°å"