{"id":15676856,"url":"https://github.com/silverwind/save-csv","last_synced_at":"2025-05-06T22:07:18.790Z","repository":{"id":66013079,"uuid":"99517112","full_name":"silverwind/save-csv","owner":"silverwind","description":"Download an array of objects as a CSV file in the browser","archived":false,"fork":false,"pushed_at":"2018-11-24T20:46:07.000Z","size":159,"stargazers_count":13,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T22:03:58.644Z","etag":null,"topics":["browser","csv","csv-download","csv-export","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silverwind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-06T22:35:52.000Z","updated_at":"2022-08-08T20:05:07.000Z","dependencies_parsed_at":"2023-06-02T10:30:41.334Z","dependency_job_id":null,"html_url":"https://github.com/silverwind/save-csv","commit_stats":{"total_commits":136,"total_committers":3,"mean_commits":"45.333333333333336","dds":"0.014705882352941124","last_synced_commit":"a8a36f2f306a343b462d8a6012fecfca2735701c"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fsave-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fsave-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fsave-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fsave-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silverwind","download_url":"https://codeload.github.com/silverwind/save-csv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252776579,"owners_count":21802467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","csv","csv-download","csv-export","javascript"],"created_at":"2024-10-03T16:06:25.569Z","updated_at":"2025-05-06T22:07:18.772Z","avatar_url":"https://github.com/silverwind.png","language":"JavaScript","readme":"# save-csv\n[![](https://img.shields.io/npm/v/save-csv.svg?style=flat)](https://www.npmjs.org/package/save-csv) [![](https://img.shields.io/npm/dm/save-csv.svg)](https://www.npmjs.org/package/save-csv) [![](https://api.travis-ci.org/silverwind/save-csv.svg?style=flat)](https://travis-ci.org/silverwind/save-csv)\n\u003e Download an array of objects as a CSV file in the browser\n\n`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:\n\n- Automatically detects the value separator (usually `,`) based on the user's regional settings.\n- Saves UTF8 by default and helps Excel to recognize this by adding a [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark).\n- Fully configurable. Every output character can be modified via options.\n\n## Example\n```html\n\u003cscript src=\"save-csv.min.js\"\u003e\u003c/script\u003e\n```\n```js\nsaveCsv([\n  {a:1, b:2},\n  {a:3, b:4},\n]);\n```\n#### Output\n```csv\na,b\n1,2\n3,4\n```\n\n## API\n### save-csv(array, [options])\n- `array` *Array*: An array containing objects with matching keys.\n- `options` *Object*\n  - `filename` *string*: The filename to save to. Default: `export.csv`.\n  - `sep` *string*: The value separator (usually `,`). Recognizes the special value `auto` with which automatic detection based on the user's regional settings is attempted (See [#1](https://github.com/silverwind/save-csv/issues/1)). Default: `auto`.\n  - `eol` *string*: The line separator. Default: `\\r\\n`.\n  - `quote` *string*: The quote character to use. Default: `\"`.\n  - `bom` *boolean*: Whether to include a [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark) in the output. Default: `true`.\n  - `mime` *string*: The mime type for the file. Default: `text/csv;charset=utf-8`.\n  - `formatter` *Function*: A custom formatter function for values. The default function handles `sep` in values and uses `JSON.stringify` for complex values. Receives `value`.\n\n© [silverwind](https://github.com/silverwind), distributed under BSD licence\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Fsave-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilverwind%2Fsave-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Fsave-csv/lists"}