4.1.0 • Published 7 years ago
save-csv v4.1.0
save-csv
Download an array of objects as a CSV file in the browser
save-csv is a tiny library (892 bytes gzipped) that creates an CSV file from a array of objects with matching keys and triggers a download in the browser. Features:
- Automatically detects the value separator (usually
,) based on the user's regional settings. - Saves UTF8 by default and helps Excel to recognize this by adding a byte order mark.
- Fully configurable. Every output character can be modified via options.
Example
<script src="save-csv.min.js"></script>saveCsv([
{a:1, b:2},
{a:3, b:4},
]);Output
a,b
1,2
3,4API
save-csv(array, options)
arrayArray: An array containing objects with matching keys.optionsObjectfilenamestring: The filename to save to. Default:export.csv.sepstring: The value separator (usually,). Recognizes the special valueautowith which automatic detection based on the user's regional settings is attempted (See #1). Default:auto.eolstring: The line separator. Default:\r\n.quotestring: The quote character to use. Default:".bomboolean: Whether to include a byte order mark in the output. Default:true.mimestring: The mime type for the file. Default:text/csv;charset=utf-8.formatterFunction: A custom formatter function for values. The default function handlessepin values and usesJSON.stringify for complex values. Receivesvalue`.
© silverwind, distributed under BSD licence
4.1.0
7 years ago
4.0.7
7 years ago
4.0.6
8 years ago
4.0.5
8 years ago
4.0.4
8 years ago
4.0.3
8 years ago
4.0.2
8 years ago
4.0.1
8 years ago
4.0.0
8 years ago
3.1.2
8 years ago
3.1.1
8 years ago
3.1.0
8 years ago
3.0.0
8 years ago
2.0.1
8 years ago
2.0.0
8 years ago
1.1.10
8 years ago
1.1.9
8 years ago
1.1.8
8 years ago
1.1.7
8 years ago
1.1.6
8 years ago
1.1.5
8 years ago
1.1.4
8 years ago
1.1.3
8 years ago
1.1.2
8 years ago
1.1.1
8 years ago
1.1.0
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago
0.1.0
8 years ago