{"id":20285646,"url":"https://github.com/marcisbee/datacsv","last_synced_at":"2025-04-11T08:40:25.026Z","repository":{"id":35156601,"uuid":"189592850","full_name":"Marcisbee/datacsv","owner":"Marcisbee","description":"💾 Very simple file based database for node","archived":false,"fork":false,"pushed_at":"2022-05-29T07:27:48.000Z","size":59,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T20:33:05.519Z","etag":null,"topics":["csv","database","file","javascript","node","simple"],"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/Marcisbee.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}},"created_at":"2019-05-31T12:48:13.000Z","updated_at":"2023-03-08T15:34:57.000Z","dependencies_parsed_at":"2022-08-28T10:00:56.002Z","dependency_job_id":null,"html_url":"https://github.com/Marcisbee/datacsv","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Fdatacsv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Fdatacsv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Fdatacsv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Fdatacsv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marcisbee","download_url":"https://codeload.github.com/Marcisbee/datacsv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248362344,"owners_count":21091099,"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","database","file","javascript","node","simple"],"created_at":"2024-11-14T14:28:02.957Z","updated_at":"2025-04-11T08:40:24.999Z","avatar_url":"https://github.com/Marcisbee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Datacsv\n`Data`base + `csv` is very simple file based database for node.\nIt uses CSV file structure and locally creates manipulates files as real db would.\n\nFeatures:\n- create table\n- clear (truncate) table\n- get row/s\n- add row/s\n- edit row/s\n- delete row/s\n\n## Motivation\nI was in need of very simple database for creating a mock database and tought that CSV would actually do what I need. I can open csv files, edit them manually and with this package also do everything programmatically.\n\n## Installation\nTo install the stable version:\n\n```\nnpm i --save datacsv\n```\n\nThis assumes you are using [npm](https://www.npmjs.com/) as your package manager.\n\n## Documentation\nRequire package in the project.\n\n```js\nconst db = require('datacsv');\n```\n\nAnd now we can initialise table/s.\n\n- path: string _(Location of csv file)_\n- headers: { [string]: string | Function }\n\nSchema is entirely optional (required only if for example data needs custom transformation).\n\n```js\n// `age` will be saved and treated as number in database\nconst headers = {\n  name: String,\n  email: String,\n  age: Number,\n}\n\nconst users = await db('users.csv', headers)\n```\n\n### `add`\nAdding data to table.\n\n- data: { [string]: any }[]\n\nIt will automatically add `id` field.\nReturns added rows.\n\n```js\nawait users.add([\n  {\n    name: 'John',\n    email: 'john.doe@localhost',\n    age: 21,\n  }\n])\n/* [ { id: 'h4HNOfnLp',\n *     name: 'John',\n *     email: 'john.doe@localhost',\n *     age: 21 } ]\n */\n```\n\n### `get`\nTo get all existing fields from table.\n\n- filter?: { [string]: any }\n\nIf no filter provided, it will return all rows from table.\n\n```js\nawait users.get({\n  age: 21\n})\n/* [ { id: 'h4HNOfnLp',\n *     name: 'John',\n *     email: 'john.doe@localhost',\n *     age: 21 } ]\n */\n```\n\n### `edit`\nTo edit data in table.\n\n- filter: { [string]: any }\n- data: { [string]: any }\n\nIf no filter provided, it will update all rows in table.\nReturns edited rows.\n\n```js\nawait users.edit(\n  {\n    id: 'h4HNOfnLp'\n  },\n  {\n    name: 'Jane',\n    email: 'jane.doe@localhost',\n  }\n)\n/* [ { id: 'h4HNOfnLp',\n *     name: 'Jane',\n *     email: 'jane.doe@localhost',\n *     age: 21 } ]\n */\n```\n\n### `delete`\nTo delete data from table.\n\n- filter?: { [string]: any }\n\nIf no filter provided, it will update all rows in table.\nReturns deleted rows.\n\n```js\nawait users.delete({\n  name: 'Jane'\n})\n/* [ { id: 'h4HNOfnLp',\n *     name: 'Jane',\n *     email: 'jane.doe@localhost',\n *     age: 21 } ]\n */\n```\n\n## Stay In Touch\n\n- [Twitter](https://twitter.com/marcisbee)\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2019-present, Marcis (Marcisbee) Bergmanis\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcisbee%2Fdatacsv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcisbee%2Fdatacsv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcisbee%2Fdatacsv/lists"}