{"id":16693996,"url":"https://github.com/haoliangyu/rx-to-csv","last_synced_at":"2025-04-10T01:33:14.918Z","repository":{"id":143907253,"uuid":"91215970","full_name":"haoliangyu/rx-to-csv","owner":"haoliangyu","description":"RxJS 5 operator to write data into a CSV file","archived":false,"fork":false,"pushed_at":"2017-08-29T03:14:37.000Z","size":63,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T13:36:54.326Z","etag":null,"topics":["csv","operator","read","rxjs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/haoliangyu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-05-14T02:53:41.000Z","updated_at":"2022-11-22T00:05:03.000Z","dependencies_parsed_at":"2024-03-01T08:45:38.148Z","dependency_job_id":null,"html_url":"https://github.com/haoliangyu/rx-to-csv","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haoliangyu%2Frx-to-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haoliangyu%2Frx-to-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haoliangyu%2Frx-to-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haoliangyu%2Frx-to-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haoliangyu","download_url":"https://codeload.github.com/haoliangyu/rx-to-csv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248140623,"owners_count":21054323,"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":["csv","operator","read","rxjs"],"created_at":"2024-10-12T16:43:23.239Z","updated_at":"2025-04-10T01:33:14.863Z","avatar_url":"https://github.com/haoliangyu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rx-to-csv\n\n![build status](https://travis-ci.org/haoliangyu/rx-to-csv.svg?branch=master)\n\n[![ReactiveX](http://reactivex.io/assets/Rx_Logo_S.png)](http://reactivex.io/)\n\n[RxJS 5](http://reactivex.io/) operator to write data into a [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) file\n\nWork in both JavaScript and TypeScript\n\n## Installation\n\n```\nnpm install rx-to-csv\n```\n\n## Use\n\nImport this library and it will add `toCSV` operator to the rxjs `Observable` class.\n\n```\npublic toCSV(path: string, columns: Array\u003cstring\u003e, options?: any): Observable\n```\n\nThis operator will search values in its input by column names and write them into the target CSV file via a write file stream.\n\nParameters:\n\n  * **path**: csv file path\n  * **columns**: an array of column names\n  * **options**: optional configuration for the csv creation\n    * **wrapText**: a boolean value indicating whether to wrap text values with `\"`. Default: `true`\n    * **delimiter**: a character to separate values. Default: `,`\n\n## Example\n\nGenerate a CSV file from data flow:\n\n``` javascript\nimport { Observable } from 'rxjs';\nimport 'rx-to-csv';\n\nlet data = [\n  { id: 1, name: 'Mike' },\n  { id: 2, name: 'Tommy' }\n];\n\nObservable.of(...data)\n  .toCSV('data.csv', ['id', 'name'])\n  .subscribe();\n```\n\nDownload data from a PostgreSQL dadtabase and save it as a CSV file:\n\n``` javascript\nimport pgrx from 'pg-reactive';\nimport 'rx-to-csv';\n\nlet db = new pgrx('connection string');\n\ndb.query('SELECT id, display_name FROM users')\n  .map((row) =\u003e {\n    // convert the data to match column names\n    return {\n      id: row.id,\n      name: row.display_name\n    };\n  })\n  .toCSV('data.csv', ['id', 'name'])\n  .subscribe();\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaoliangyu%2Frx-to-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaoliangyu%2Frx-to-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaoliangyu%2Frx-to-csv/lists"}