{"id":19815411,"url":"https://github.com/nuzulul/node-key-value-storage","last_synced_at":"2025-02-28T14:40:08.275Z","repository":{"id":219138057,"uuid":"748113889","full_name":"nuzulul/node-key-value-storage","owner":"nuzulul","description":"Create data storage that uses a simple key-value method","archived":false,"fork":false,"pushed_at":"2024-01-26T16:58:55.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-27T01:22:16.774Z","etag":null,"topics":["data-storage","data-store","file-database","file-storage","key-value-storage","kv-storage","node-js","node-key-value-storage","nodejs","nosql","nosql-database"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/p/devbox/nodejs-key-value-storage-lk3g7f","language":"TypeScript","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/nuzulul.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-25T09:57:04.000Z","updated_at":"2024-01-30T16:52:27.000Z","dependencies_parsed_at":"2024-01-25T17:43:25.112Z","dependency_job_id":"71b37a6c-06d0-4dc1-ab8a-52ea5705cefd","html_url":"https://github.com/nuzulul/node-key-value-storage","commit_stats":null,"previous_names":["nuzulul/key-value-storage"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuzulul%2Fnode-key-value-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuzulul%2Fnode-key-value-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuzulul%2Fnode-key-value-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuzulul%2Fnode-key-value-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuzulul","download_url":"https://codeload.github.com/nuzulul/node-key-value-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241168246,"owners_count":19921365,"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":["data-storage","data-store","file-database","file-storage","key-value-storage","kv-storage","node-js","node-key-value-storage","nodejs","nosql","nosql-database"],"created_at":"2024-11-12T10:05:56.523Z","updated_at":"2025-02-28T14:40:08.256Z","avatar_url":"https://github.com/nuzulul.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-key-value-storage\nCreate data storage that uses a simple key-value method\n\n[![NPM](https://nodei.co/npm/node-key-value-storage.png?mini=true)](https://www.npmjs.com/package/node-key-value-storage)\n[![npm version](https://badge.fury.io/js/node-key-value-storage.svg)](https://www.npmjs.com/package/node-key-value-storage)\n\n## Features\n\n* ✅ 0 Dependencies\n* ✅ NoSQL Database\n* ✅ Lightwight\n\n## Demo\n\n[https://codesandbox.io/p/devbox/nodejs-key-value-storage-lk3g7f](https://codesandbox.io/p/devbox/nodejs-key-value-storage-lk3g7f)\n\n## Installation\n\n```javascript\nnpm install node-key-value-storage\n```\n\n## Initialization\n\n```javascript\n//ES Modules import style\nimport {Nkvs} from 'node-key-value-storage'\n\n//CommonJS import style\nconst {Nkvs} = require('node-key-value-storage')\n\nconst db = await Nkvs.init({\n\tstorageName:'mystorage'\n})\n```\n\n## Example Usage\n\n```javascript\nimport {Nkvs} from 'node-key-value-storage'\n\nvoid async function main() {\n\tconst db = await Nkvs.init({\n\t\tstorageName:'mystorage'\n\t})\n\t\n\tconsole.log(await db.put('yes','no'))\n\tconsole.log(await db.get('yes'))\n\tconsole.log(await db.list())\n\tconsole.log(await db.delete('yes'))\n}()\n```\n\n```javascript\nconst {Nkvs} = require('node-key-value-storage')\n\nvoid async function main() {\n\tconst db = await Nkvs.init({\n\t\tstorageName:'mystorage'\n\t})\n\t\n\tconsole.log(await db.put('yes','no'))\n\tconsole.log(await db.get('yes'))\n\tconsole.log(await db.list())\n\tconsole.log(await db.delete('yes'))\n}()\n```\n\n## API Reference\n\n### Init Parameters\n\n```javascript\nawait init({\n\tdataDirName?:string,\n\tstorageName:string \n})\n```\n* dataDirName =  (Optional) Alphanumeric name of data directory (default = 'data')\n* storageName = (Required) Alphanumeric name of storage\n\n### Write key-value pairs\n\n```javascript\nawait put(key:string,value:string)\n```\nThe put() method returns a Promise that you should await on to verify a successful update which resolves with a boolean :\n* true = Update successful\n* false = Update failed\n### Read key-value pairs\n\n```javascript\nawait get(key:string)\n```\nThe get() method returns a promise you can await on to get the value which resolves with:\n* null = The key is not found\n* data = Get the value successful\n* false = Get the value failed\n\n### List keys\n\n```javascript\nawait list()\n```\nUse a list operation to view all the keys that live in a given storage, return a promise which resolves with an object:\n* keys = Array of keys\n* complete = True if operation complete\n\n### Delete key-value pairs\n\n```javascript\nawait delete(key:string)\n```\n\nTo delete a key-value pair, call the delete() method, return a promise which resolves with:\n* null = The key is not found\n* true = Delete successful\n* false = Delete failed\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuzulul%2Fnode-key-value-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuzulul%2Fnode-key-value-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuzulul%2Fnode-key-value-storage/lists"}