{"id":15731813,"url":"https://github.com/DraCaster/lushan-packages","last_synced_at":"2025-04-18T21:31:39.158Z","repository":{"id":92343268,"uuid":"253564863","full_name":"DraCaster/lushan-packages","owner":"DraCaster","description":"Set of packages to make development easier","archived":false,"fork":false,"pushed_at":"2021-04-25T21:47:17.000Z","size":13,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-09T04:08:40.242Z","etag":null,"topics":["batch","csv","export","export-csvfile","export-to-csv","mongodb-database","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DraCaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-04-06T17:10:11.000Z","updated_at":"2021-04-25T21:47:19.000Z","dependencies_parsed_at":"2023-05-16T22:45:12.050Z","dependency_job_id":null,"html_url":"https://github.com/DraCaster/lushan-packages","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"2e9067658562fb87d19bc3b88d3aa7e758d8051b"},"previous_names":["dracaster/lushan-export-to-csv"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DraCaster%2Flushan-packages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DraCaster%2Flushan-packages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DraCaster%2Flushan-packages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DraCaster%2Flushan-packages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DraCaster","download_url":"https://codeload.github.com/DraCaster/lushan-packages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783200,"owners_count":17201914,"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":["batch","csv","export","export-csvfile","export-to-csv","mongodb-database","nodejs"],"created_at":"2024-10-04T00:05:54.588Z","updated_at":"2024-11-09T04:08:43.512Z","avatar_url":"https://github.com/DraCaster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Contributors][contributors-shield]][contributors-url]\n[![Stargazers][stars-shield]][stars-url]\n\n# lushan-packages\n\nSet of packages to make development easier :)\n\n# Content:\n\n- lushan-export-to-csv\n- lushan-random-string\n\n# lushan-export-to-csv\n\nYou can export records stored in the Mongo DB, to a CSV file.\n\n### Installation\n\n```js\n\nnpm install @dracaster/lushan-export-to-csv@1.0.0\n\n```\n\n### Usage\n\n```js\n\nconst csv = require(‘lushan-export-to-csv’);\n\n```\n\n### Methods:\n\n```js\n\nexportCsv()\n\n```\n\n### Definition and usage:\n\n_Allows you to generate a csv batch. This method returns the download link of the generated file_\n\n### Syntax\n\n```js\n\ncsv.exportCsv(EntityName, Headers, Cursor, BaseUrl, DestinationFolder)\n\n```\n\n### Parameters values\n\n- **EntityName** : Required. Name of the entity you want to export. This will be used to generate the file name. For example citizens, companies, etc. (Type: String)\n\n- **Headers** : Required. Will be used as a column heading. (Type: Array)\n\n- **Cursor** : Required. A pointer to the result set of a query. Will be used to generate the batch. More information about cursors in MongoDB: https://docs.mongodb.com/manual/reference/glossary/#term-cursor\n\n- **BaseUrl** : Required. API base Url (Type: String)\n\n- **DestinationFolder** : Required. Destination folder where the csv is generated. This folder must exist in your project. (Type: String)\n\n### Example\n\n```js\n\nconst csv = require(‘lushan-export-to-csv’);\n\nconst headers = ['name','telephone']\n\nconst baseUrl = \"YOUR_API_URL\"\n\n\n/*This is an example of how you can get a cursor in MongoDB_\nIn this example I want to filter on my people collection, and get certain fields*/\n\n//queryFilters: filters to apply\n//headers: I return the fields that I require to generate my csv (These will be the headers in my batch file)\n\nlet cursor = await people.find(queryFilters, headers).cursor()\n\ncsv.exportCsv('My-Company', headers, cursor, baseUrl, 'batches')\n\n```\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n\n[stars-shield]: https://img.shields.io/github/stars/dracaster/lushan-export-to-csv.svg?style=flat-square\n[stars-url]: https://github.com/DraCaster/lushan-export-to-csv/stargazers\n[contributors-shield]: https://img.shields.io/github/contributors/dracaster/lushan-export-to-csv.svg?style=flat-square\n[contributors-url]: https://github.com/dracaster/lushan-export-to-csv/graphs/contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDraCaster%2Flushan-packages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDraCaster%2Flushan-packages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDraCaster%2Flushan-packages/lists"}