{"id":23336122,"url":"https://github.com/taoyuan/kvs-simple","last_synced_at":"2025-04-07T13:14:20.924Z","repository":{"id":48174392,"uuid":"299631563","full_name":"taoyuan/kvs-simple","owner":"taoyuan","description":"A kvs simple storage adapter that supports input and output","archived":false,"fork":false,"pushed_at":"2021-05-12T12:37:08.000Z","size":401,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T15:49:53.476Z","etag":null,"topics":["adapter","file","io","kvs","load","memory","read","save","write"],"latest_commit_sha":null,"homepage":"","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/taoyuan.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":"2020-09-29T13:49:20.000Z","updated_at":"2022-07-22T08:51:54.000Z","dependencies_parsed_at":"2022-08-28T08:04:11.977Z","dependency_job_id":null,"html_url":"https://github.com/taoyuan/kvs-simple","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoyuan%2Fkvs-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoyuan%2Fkvs-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoyuan%2Fkvs-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoyuan%2Fkvs-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taoyuan","download_url":"https://codeload.github.com/taoyuan/kvs-simple/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657271,"owners_count":20974345,"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":["adapter","file","io","kvs","load","memory","read","save","write"],"created_at":"2024-12-21T02:12:05.161Z","updated_at":"2025-04-07T13:14:20.899Z","avatar_url":"https://github.com/taoyuan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kvs-simple\n\n\u003e A [kvs](https://github.com/taoyuan/kvs) simple storage adapter that supports\n\u003e input and output\n\n## Install\n\n```shell\nnpm i kvs kvs-simple\n```\n\n## Usage\n\n### Using default FileIO\n\n```js\nimport {Store} from 'kvs';\n// import Simple from 'kvs-simple';\n\n(async () =\u003e {\n  const store = Store.create('simple' /* Simple */, {\n    file: 'data.json',\n    expiresCheckInterval: 24 * 3600 * 1000, // ms, check and remove expired data in each ms\n    writeDelay: 100, // ms, batch write to disk in a specific duration, enhance write performance.\n    codec: {\n      encode: JSON.stringify, // serialize function\n      decode: JSON.parse, // deserialize function\n    },\n  });\n\n  const bucket = await store.bucket('namespace');\n\n  bucket.set('key', 'value');\n  const value = await bucket.get('key');\n})();\n```\n\n### Using custom IO\n\n```js\nimport fs from 'fs';\nimport {Store} from 'kvs';\n// import Simple from 'kvs-simple';\n\n(async () =\u003e {\n  const store = Store.create('simple' /* Simple */, {\n    expiresCheckInterval: 24 * 3600 * 1000, // ms, check and remove expired data in each ms\n    writeDelay: 100, // ms, batch write to disk in a specific duration, enhance write performance.\n    io: {\n      read: async () =\u003e fs.readFileSync('data.json', 'utf8'),\n      write: async data =\u003e fs.outputFile('data.json', data, 'utf8'),\n    },\n  });\n\n  const bucket = await store.bucket('namespace');\n\n  bucket.set('key', 'value');\n  const value = await bucket.get('key');\n})();\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaoyuan%2Fkvs-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaoyuan%2Fkvs-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaoyuan%2Fkvs-simple/lists"}