{"id":28684901,"url":"https://github.com/node-modules/diskstore","last_synced_at":"2025-10-05T02:43:59.718Z","repository":{"id":25820743,"uuid":"106530946","full_name":"node-modules/diskstore","owner":"node-modules","description":"a local cache implement","archived":false,"fork":false,"pushed_at":"2022-12-17T15:46:55.000Z","size":20,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-04T16:46:27.736Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-10-11T09:04:22.000Z","updated_at":"2023-02-02T09:26:45.000Z","dependencies_parsed_at":"2023-01-14T03:29:38.830Z","dependency_job_id":null,"html_url":"https://github.com/node-modules/diskstore","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/diskstore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fdiskstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fdiskstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fdiskstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fdiskstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/diskstore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fdiskstore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752078,"owners_count":22905972,"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":[],"created_at":"2025-06-14T03:07:37.059Z","updated_at":"2025-10-05T02:43:54.680Z","avatar_url":"https://github.com/node-modules.png","language":"JavaScript","readme":"# diskstore\n\na basic local cache implementation\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/node-modules/diskstore/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/diskstore/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/diskstore.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/diskstore\n[codecov-image]: https://codecov.io/gh/node-modules/diskstore/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/diskstore\n[download-image]: https://img.shields.io/npm/dm/diskstore.svg?style=flat-square\n[download-url]: https://npmjs.org/package/diskstore\n\n## Introduction\n\nA basic file cache implementation. It just providers low-level APIs (get, set, delete) to allow you read \u0026 atomic write from file cache.  You can also create your implementation by inheriting or wrapping it.\n\n## Install\n\n```bash\nnpm install diskstore --save\n```\n\n## APIs\n\n- `new DiskStore(options)`\n  - {String} cacheDir - root cache dir\n- `async get(relativePath)` read data from relativePath if the file exists.\n  - {String} relativePath - file path relative to root cache dir\n- `async set(relativePath, data)` write data to relativePath\n  - {String} relativePath - file path relative to root cache dir\n  - {Buffer|String} data - the data\n- `async delete(relativePath)` delete the file\n  - {String} relativePath - file path relative to root cache dir\n\n## Usage\n\n```js\nconst diskStore = new DiskStore({\n  cacheDir: '/path/cache',\n});\n\nawait diskStore.set('a/b/c', 'c');\nlet data = await diskStore.get('a/b/c');\nassert.deepEqual(data, Buffer.from('c'));\n\nawait diskStore.delete('a/b/c');\ndata = await diskStore.get('a/b/c');\nassert(data === null);\n```\n\n## License\n\n[MIT](LICENSE)\n\n\u003c!-- GITCONTRIBUTOR_START --\u003e\n\n## Contributors\n\n|[\u003cimg src=\"https://avatars.githubusercontent.com/u/546535?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003eleoner\u003c/b\u003e\u003c/sub\u003e](https://github.com/leoner)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1207064?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003egxcsoccer\u003c/b\u003e\u003c/sub\u003e](https://github.com/gxcsoccer)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/156269?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003efengmk2\u003c/b\u003e\u003c/sub\u003e](https://github.com/fengmk2)\u003cbr/\u003e|\n| :---: | :---: | :---: |\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Thu Jun 02 2022 15:25:27 GMT+0800`.\n\n\u003c!-- GITCONTRIBUTOR_END --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fdiskstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fdiskstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fdiskstore/lists"}