{"id":14975620,"url":"https://github.com/lykmapipo/mongoose-exportable","last_synced_at":"2025-04-04T17:15:30.572Z","repository":{"id":34240584,"uuid":"171503250","full_name":"lykmapipo/mongoose-exportable","owner":"lykmapipo","description":"mongoose plugin to add exports behavior","archived":false,"fork":false,"pushed_at":"2023-03-01T02:22:50.000Z","size":1962,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T17:53:17.604Z","etag":null,"topics":["csv","download","export","exportable","lykmapipo","mongoose","mongoose-plugin"],"latest_commit_sha":null,"homepage":"","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/lykmapipo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-19T15:54:18.000Z","updated_at":"2025-01-20T20:50:15.000Z","dependencies_parsed_at":"2024-06-21T12:57:49.582Z","dependency_job_id":"7434aa98-d7a3-4379-a81e-d1556fab87fb","html_url":"https://github.com/lykmapipo/mongoose-exportable","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-exportable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-exportable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-exportable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-exportable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lykmapipo","download_url":"https://codeload.github.com/lykmapipo/mongoose-exportable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217220,"owners_count":20903009,"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","download","export","exportable","lykmapipo","mongoose","mongoose-plugin"],"created_at":"2024-09-24T13:52:17.818Z","updated_at":"2025-04-04T17:15:30.543Z","avatar_url":"https://github.com/lykmapipo.png","language":"JavaScript","readme":"# mongoose-exportable\n\n[![Build Status](https://app.travis-ci.com/lykmapipo/mongoose-exportable.svg?branch=master)](https://app.travis-ci.com/lykmapipo/mongoose-exportable)\n[![Dependencies Status](https://david-dm.org/lykmapipo/mongoose-exportable.svg)](https://david-dm.org/lykmapipo/mongoose-exportable)\n[![Coverage Status](https://coveralls.io/repos/github/lykmapipo/mongoose-exportable/badge.svg?branch=master)](https://coveralls.io/github/lykmapipo/mongoose-exportable?branch=master)\n[![GitHub License](https://img.shields.io/github/license/lykmapipo/mongoose-exportable)](https://github.com/lykmapipo/mongoose-exportable/blob/develop/LICENSE)\n\n[![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Code Style](https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)\n[![npm version](https://img.shields.io/npm/v/@lykmapipo/mongoose-exportable)](https://www.npmjs.com/package/@lykmapipo/mongoose-exportable)\n\nmongoose plugin to add exports behavior. \n\n## Requirements\n\n- [NodeJS v13+](https://nodejs.org)\n- [Npm v6.12+](https://www.npmjs.com/)\n- [MongoDB v4+](https://www.mongodb.com/)\n- [Mongoose v6+](https://github.com/Automattic/mongoose)\n\n## Install\n```sh\n$ npm install --save mongoose @lykmapipo/mongoose-exportable\n```\n\n## Usage\n\n```javascript\nimport mongoose from 'mongoose';\nimport exportable from '@lykmapipo/mongoose-exportable';\n\nconst UserSchema = new Schema({ name: { type: String, exportable: true } });\nUserSchema.plugin(exportable);\nconst User = mongoose.model('User', UserSchema);\n\n// fs use \nconst out = fs.createWriteStream('out.csv');\nUser.exportCsv().pipe(out);\n\n// express use\napp.get('/users/export', (request, response) =\u003e {\n    response.attachment('out.csv');\n    response.status(200);\n    User.exportCsv().pipe(response);\n});\n```\n\n## Environment\n```js\nNUMBER_MISSING_VALUE=0\nSTRING_MISSING_VALUE=NA\n```\n\n## API\n\n### `exportable(schema: Schema, [options: Object])`\nA exportable schema plugin. Once applied to a schema will compute `exportable` paths and add [exportCsv](#exportcsvoptns-object-out-writablestream-cb-function) model `static` function.\n\nExample\n```js\nconst UserSchema = new Schema({ name: { type: String, exportable: true } });\nUserSchema.plugin(exportable);\nconst User = mongoose.model('User', UserSchema);\n```\n\n### `exportCsv([optns: Object], [out: WritableStream], [cb: Function])`\nCreate `csv` export readable stream.\n\nUsage with `fs`:\n```js\nconst out = fs.createWriteStream('out.csv');\nUser.exportCsv().pipe(out);\n```\n\nUsage with `express`\n```js\napp.get('/users/export', (request, response) =\u003e {\n    response.attachment('out.csv');\n    response.status(200);\n    User.exportCsv().pipe(response);\n});\n```\n\n## Testing\n* Clone this repository\n\n* Install all development dependencies\n```sh\n$ npm install\n```\n* Then run test\n```sh\n$ npm test\n```\n\n## Contribute\nIt will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.\n\n## Licence\nThe MIT License (MIT)\n\nCopyright (c) lykmapipo \u0026 Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fmongoose-exportable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykmapipo%2Fmongoose-exportable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fmongoose-exportable/lists"}