{"id":20390259,"url":"https://github.com/nonebot/plugin-localstore","last_synced_at":"2025-03-02T13:09:44.631Z","repository":{"id":46314807,"uuid":"350270266","full_name":"nonebot/plugin-localstore","owner":"nonebot","description":"Local Storage Support for NoneBot2","archived":false,"fork":false,"pushed_at":"2024-09-03T08:08:19.000Z","size":214,"stargazers_count":22,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T23:33:41.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nonebot.dev/docs/best-practice/data-storing","language":"Python","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/nonebot.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},"funding":{"open_collective":"nonebot","custom":["https://afdian.com/@nonebot"]}},"created_at":"2021-03-22T08:48:24.000Z","updated_at":"2024-10-24T16:17:46.000Z","dependencies_parsed_at":"2023-11-19T12:33:44.581Z","dependency_job_id":"73c82909-102f-4d49-8728-164eb3ab1cb8","html_url":"https://github.com/nonebot/plugin-localstore","commit_stats":{"total_commits":62,"total_committers":8,"mean_commits":7.75,"dds":0.3870967741935484,"last_synced_commit":"a3cbcc8ca60799ea04bac0a42874cf1cd213eeab"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-localstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-localstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-localstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-localstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonebot","download_url":"https://codeload.github.com/nonebot/plugin-localstore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239949745,"owners_count":19723552,"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":"2024-11-15T03:23:54.982Z","updated_at":"2025-03-02T13:09:44.608Z","avatar_url":"https://github.com/nonebot.png","language":"Python","funding_links":["https://opencollective.com/nonebot","https://afdian.com/@nonebot"],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD041 --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://nonebot.dev/\"\u003e\u003cimg src=\"https://nonebot.dev/logo.png\" width=\"200\" height=\"200\" alt=\"nonebot\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# NoneBot Plugin LocalStore\n\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable-next-line MD036 --\u003e\n_✨ NoneBot 本地数据存储插件 ✨_\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://raw.githubusercontent.com/nonebot/plugin-localstore/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/nonebot/plugin-localstore.svg\" alt=\"license\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.python.org/pypi/nonebot-plugin-localstore\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/nonebot-plugin-localstore.svg\" alt=\"pypi\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3.8+-blue.svg\" alt=\"python\"\u003e\n\u003c/p\u003e\n\n## 使用方式\n\n加载插件后使用 `require` 声明插件依赖，直接使用 `localstore` 插件提供的函数即可。\n\n```python\nfrom pathlib import Path\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_localstore\")\n\nimport nonebot_plugin_localstore as store\n\nplugin_cache_dir: Path = store.get_plugin_cache_dir()\nplugin_cache_file: Path = store.get_plugin_cache_file(\"filename\")\nplugin_config_dir: Path = store.get_plugin_config_dir()\nplugin_config_file: Path = store.get_plugin_config_file(\"filename\")\nplugin_data_dir: Path = store.get_plugin_data_dir()\nplugin_data_file: Path = store.get_plugin_data_file(\"filename\")\n```\n\n## 存储路径\n\n在项目安装插件后，可以使用 `nb-cli` 查看具体的存储路径：\n\n```bash\nnb localstore\n```\n\n参考路径如下：\n\n### cache path\n\n- macOS: `~/Library/Caches/\u003cAppName\u003e`\n- Unix: `~/.cache/\u003cAppName\u003e` (XDG default)\n- Windows: `C:\\Users\\\u003cusername\u003e\\AppData\\Local\\\u003cAppName\u003e\\Cache`\n\n### data path\n\n- macOS: `~/Library/Application Support/\u003cAppName\u003e`\n- Unix: `~/.local/share/\u003cAppName\u003e` or in $XDG_DATA_HOME, if defined\n- Win XP (not roaming): `C:\\Documents and Settings\\\u003cusername\u003e\\Application Data\\\u003cAppName\u003e`\n- Win 7 (not roaming): `C:\\Users\\\u003cusername\u003e\\AppData\\Local\\\u003cAppName\u003e`\n\n### config path\n\n- macOS: same as user_data_dir\n- Unix: `~/.config/\u003cAppName\u003e`\n- Win XP (roaming): `C:\\Documents and Settings\\\u003cusername\u003e\\Local Settings\\Application Data\\\u003cAppName\u003e`\n- Win 7 (roaming): `C:\\Users\\\u003cusername\u003e\\AppData\\Roaming\\\u003cAppName\u003e`\n\n## 配置项\n\n插件支持配置全局存储路径，也支持为插件单独配置存储路径。\n\n```dotenv\nLOCALSTORE_CACHE_DIR=/tmp/cache\nLOCALSTORE_DATA_DIR=/tmp/data\nLOCALSTORE_CONFIG_DIR=/tmp/config\n\nLOCALSTORE_PLUGIN_CACHE_DIR='\n{\n  \"plugin1\": \"/tmp/plugin1/cache\",\n  \"plugin2:sub_plugin\": \"/tmp/plugin2/sub_plugin/cache\"\n}\n'\nLOCALSTORE_PLUGIN_DATA_DIR='\n{\n  \"plugin1\": \"/tmp/plugin1/data\",\n  \"plugin2:sub_plugin\": \"/tmp/plugin2/sub_plugin/data\"\n}\n'\nLOCALSTORE_PLUGIN_CONFIG_DIR='\n{\n  \"plugin1\": \"/tmp/plugin1/config\",\n  \"plugin2:sub_plugin\": \"/tmp/plugin2/sub_plugin/config\"\n}\n'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonebot%2Fplugin-localstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonebot%2Fplugin-localstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonebot%2Fplugin-localstore/lists"}