{"id":21817407,"url":"https://github.com/tariibaba/csv-to-xml-js","last_synced_at":"2026-04-20T05:07:38.379Z","repository":{"id":65153014,"uuid":"584582819","full_name":"tariibaba/csv-to-xml-js","owner":"tariibaba","description":"Easily convert any CSV string to XML data in Node.js and the browser.","archived":false,"fork":false,"pushed_at":"2023-01-14T20:32:54.000Z","size":80,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T18:12:10.038Z","etag":null,"topics":["browser","csv","csv-to-xml","javascript","nodejs","xml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tariibaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-03T01:29:17.000Z","updated_at":"2024-03-20T18:00:10.000Z","dependencies_parsed_at":"2023-02-09T20:30:39.678Z","dependency_job_id":null,"html_url":"https://github.com/tariibaba/csv-to-xml-js","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariibaba%2Fcsv-to-xml-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariibaba%2Fcsv-to-xml-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariibaba%2Fcsv-to-xml-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tariibaba%2Fcsv-to-xml-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tariibaba","download_url":"https://codeload.github.com/tariibaba/csv-to-xml-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244776346,"owners_count":20508506,"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-to-xml","javascript","nodejs","xml"],"created_at":"2024-11-27T15:45:47.841Z","updated_at":"2026-04-20T05:07:33.358Z","avatar_url":"https://github.com/tariibaba.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `csv-to-xml`\n\n`csv-to-xml` is an easy-to-use library that quickly converts any CSV data in a string or file to its equivalent XML representation.\n\n## Usage\n\n### CSV file\n\n`data.csv`\n\n```txt\nColor,Maximum Speed,Age\nred,120,2\nblue,150,4;\n```\n\n### CSV to XML Conversion\n\n`index.js`\n\n```js\nimport csvToXml from 'csv-to-xml';\nimport fs from 'fs/promises';\n\nconst csv = await fs.readFile('data.csv', {\n  encoding: 'utf-8',\n});\n\nconst xml = csvToXml(csv, {\n  headerList: ['color', 'maxSpeed', 'age'],\n});\n\nconsole.log(xml);\n```\n\n### Output\n\n```xml\n\u003crow\u003e\n    \u003ccolor\u003ered\u003c/color\u003e\n    \u003cmaxSpeed\u003e120\u003c/maxSpeed\u003e\n    \u003cage\u003e2\u003c/age\u003e\n\u003c/row\u003e\n\u003crow\u003e\n    \u003ccolor\u003eblue\u003c/color\u003e\n    \u003cmaxSpeed\u003e150\u003c/maxSpeed\u003e\n    \u003cage\u003e4\u003c/age\u003e\n\u003c/row\u003e\n```\n\n## API\n\n### `csvToXml(csv: string, options: CSVToXMLOptions): string`\n\nTakes string containing CSV data and returns string containing equivalent XML data.\n\n### `CSVToXMLOptions`\n\n- `eol`: character to be treated as end of a line. If unspecified, EOL character will be auto-detected.\n\n  Type: `string`\\\n  Default: `undefined`\n\n- `separator`: character used to separate each CSV column.\n\n  Type: `string`\\\n  Default: `','`\n\n- `rowName`: name given to XML element wrapping column XML elements.\n\n  Type: `string`\\\n  Default: `'row'`\n\n- `headerList`: List of custom header names to use for the CSV.\n\n  Type: `string[]`\\\n  Default: `[]`\n\n- `header`: Whether the CSV data contains a header row or not.\n\n  Type: `boolean`\\\n  Default: `true`\n\n- `indentation`: Number of spaces used to indent the XML output. A string like `\\t` or `' '` can also be passed.\n\n  Type: `number | string`\\\n  Default: `4`\n\n- `quotes`: If a column contains the separator character, you can use a quote charactor to wrap the column content, e.g., \"Coding, Beauty\" won't be split into two columns during parsing.\n\n  Type: `'single' | 'double' | 'all' | 'none' | RegExp`\n\n  - `'single'`: use single quotes\n  - `'double'`: use double quotes\n  - `'all'`: use single and double quotes\n  - `'none'`: ignore quotes - treat as part of CSV\n  - `'RegExp'`: custom regex pattern, e.g., `/[\\(|\\)]/` for column enclosed with `(` and `)`.\n\n  Default: `'none'`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftariibaba%2Fcsv-to-xml-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftariibaba%2Fcsv-to-xml-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftariibaba%2Fcsv-to-xml-js/lists"}