{"id":20767810,"url":"https://github.com/decaded/nyadb","last_synced_at":"2025-04-30T11:21:45.605Z","repository":{"id":50492910,"uuid":"519226473","full_name":"Decaded/NyaDB","owner":"Decaded","description":"NyaDB is a simple JSON \"database\" library for Node.js. It provides an easy-to-use interface for creating and managing JSON-based \"databases\" within your Node.js applications.","archived":false,"fork":false,"pushed_at":"2025-03-10T12:58:18.000Z","size":152,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T18:59:36.816Z","etag":null,"topics":["database","javascript","json","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@decaded/nyadb","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/Decaded.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"Decaded","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-07-29T13:32:28.000Z","updated_at":"2025-03-10T12:57:03.000Z","dependencies_parsed_at":"2024-02-25T11:27:29.937Z","dependency_job_id":"a120358a-27f9-4ac4-92bd-2344392e2edc","html_url":"https://github.com/Decaded/NyaDB","commit_stats":{"total_commits":103,"total_committers":4,"mean_commits":25.75,"dds":"0.47572815533980584","last_synced_commit":"2cb27477fd01bc922323daef6a8f0227e34a08d2"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decaded%2FNyaDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decaded%2FNyaDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decaded%2FNyaDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decaded%2FNyaDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Decaded","download_url":"https://codeload.github.com/Decaded/NyaDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251689009,"owners_count":21627815,"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":["database","javascript","json","nodejs"],"created_at":"2024-11-17T11:33:30.026Z","updated_at":"2025-04-30T11:21:45.597Z","avatar_url":"https://github.com/Decaded.png","language":"JavaScript","funding_links":["https://ko-fi.com/Decaded","https://ko-fi.com/L3L02XV6J"],"categories":[],"sub_categories":[],"readme":"# NyaDB\n\nSimple JSON \"database\" for NodeJS.\n\n[![npm (scoped)](https://img.shields.io/npm/v/@decaded/nyadb)](https://www.npmjs.com/package/@decaded/nyadb)\n[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@decaded/nyadb)](https://bundlephobia.com/result?p=@decaded/nyadb)\n[![npm](https://img.shields.io/npm/dt/@decaded/nyadb)](https://www.npmjs.com/package/@decaded/nyadb)\n[![GitHub](https://img.shields.io/github/license/Decaded/NyaDB)](https://github.com/Decaded/NyaDB/blob/master/LICENSE.md)\n[![Node.js version](https://img.shields.io/badge/Node.js-%3E=12.x-green.svg)](https://nodejs.org/)\n\n---\n\nAll databases are stored as **separate JSON files** in the `NyaDB` folder in the project's root directory.\n\n---\n\n## Node.js Version Requirement\n\nThis package requires Node.js version 12.x or higher for compatibility with the features and syntax used in the codebase.\n\n## Installation\n\n```sh\nnpm install @decaded/nyadb\n```\n\n## Usage\n\n### Initialize\n\n```js\nconst NyaDB = require('@decaded/nyadb');\nconst nyadb = new NyaDB();\n```\n\nYou can pass settings on initialization. [More information below](#configuration-settings).\n\n### Create new database\n\n```js\nnyadb.create('test'); // Creates a new database called 'test.json'\n```\n\n### Inserting data\n\n```js\nconst mockDatabase = {\n\tyellow: ['banana', 'citrus'],\n\tred: ['apple', 'paprika'],\n};\nnyadb.set('test', mockDatabase); // Saves data in 'test.json'\n```\n\n### Retrieving data\n\n```js\nnyadb.get('test'); // Returns the 'test' database\n\n//  {\n//    \"yellow\": [\"banana\", \"citrus\"],\n//    \"red\": [\"apple\", \"paprika\"],\n//  }\n```\n\n```js\nnyadb.getList(); // Returns the names of all databases in an array\n\n// ['test']\n```\n\n### Deleting data\n\n```js\nnyadb.delete('test'); // Deletes 'test.json'\n```\n\n## Configuration Settings\n\nYou can customize the behavior of the application by modifying the following settings.\n\n| Setting           | Default Value | Optional Values                         | Description                                                                                           |\n| ----------------- | ------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------- |\n| formattingEnabled | true          | false                                   | Enable or disable formatting of output.                                                               |\n| formattingStyle   | tab           | space                                   | Choose between using tabs or spaces for indentation.                                                  |\n| indentSize        | 4             | Any non-negative integer                | Specify the number of spaces for indentation. Only applicable if `formattingStyle` is set to \"space\". |\n| encoding          | utf8          | Any valid encoding supported by Node.js | Specify the encoding for file input/output operations.                                                |\n| enableConsoleLogs | false         | true                                    | Enable or disable logging output to the console. Errors will be logged regardless of this setting.    |\n\n### Example\n\n```js\nconst nyadb = new NyaDB({ formattingStyle: 'space', indentSize: 5 });\n```\n\n### Note\n\n- Changes to these settings will take effect immediately on initialization.\n- To return to the default values, simply remove the setting.\n\n## Migration Guide\n\n### Compatibility with previous versions\n\nNyaDB version 4 transitions from a single-file database structure (`database.json`) to a multi-file storage system, where each database is stored as its own JSON file.\n\n| ⚠   | **If migrating from version 3.x or earlier**, the system will **automatically detect** an existing `database.json` file and split it into multiple files.                                                                        |\n| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| ⚠   | **This migration is one-way and cannot be reversed. The original `database.json` file will be backed up as `database_backup.json` in the `NyaDB` folder. However, it's recommended to create your own backup before upgrading.** |\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.\n\n---\n\n## Like what I do?\n\nIf you find this project helpful or fun to use, consider supporting me on Ko-fi! Your support helps me keep creating and improving.\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L3L02XV6J)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecaded%2Fnyadb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecaded%2Fnyadb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecaded%2Fnyadb/lists"}