{"id":27063662,"url":"https://github.com/yeoman/configstore","last_synced_at":"2025-04-05T16:01:58.764Z","repository":{"id":5476257,"uuid":"6672900","full_name":"sindresorhus/configstore","owner":"sindresorhus","description":"Easily load and persist config without having to think about where and how","archived":false,"fork":false,"pushed_at":"2024-12-07T17:20:19.000Z","size":100,"stargazers_count":872,"open_issues_count":3,"forks_count":56,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-01T07:40:07.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.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":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2012-11-13T15:34:24.000Z","updated_at":"2025-03-17T23:11:56.000Z","dependencies_parsed_at":"2022-07-10T14:32:21.181Z","dependency_job_id":"7af7408e-47aa-4e8a-b80e-51a144f457a2","html_url":"https://github.com/sindresorhus/configstore","commit_stats":{"total_commits":119,"total_committers":24,"mean_commits":4.958333333333333,"dds":0.3025210084033614,"last_synced_commit":"c70d76c19abe75920bdbb8c294b64f6bae68c15b"},"previous_names":["sindresorhus/configstore","yeoman/configstore"],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fconfigstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fconfigstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fconfigstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fconfigstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/configstore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271515,"owners_count":20911587,"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-04-05T16:01:58.220Z","updated_at":"2025-04-05T16:01:58.756Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# configstore\n\n\u003e Easily load and persist config without having to think about where and how\n\nThe config is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.config`.\\\nExample: `~/.config/configstore/some-id.json`\n\n*If you need this for Electron, check out [`electron-store`](https://github.com/sindresorhus/electron-store) instead.*\\\n*And check out [`conf`](https://github.com/sindresorhus/conf) for a more modern version of `configstore`.*\n\n## Install\n\n```sh\nnpm install configstore\n```\n\n## Usage\n\n```js\nimport fs from 'node:fs';\nimport Configstore from 'configstore';\n\nconst packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));\n\n// Create a Configstore instance.\nconst config = new Configstore(packageJson.name, {foo: 'bar'});\n\nconsole.log(config.get('foo'));\n//=\u003e 'bar'\n\nconfig.set('awesome', true);\nconsole.log(config.get('awesome'));\n//=\u003e true\n\n// Use dot-notation to access nested properties.\nconfig.set('bar.baz', true);\nconsole.log(config.get('bar'));\n//=\u003e {baz: true}\n\nconfig.delete('awesome');\nconsole.log(config.get('awesome'));\n//=\u003e undefined\n```\n\n## API\n\n### Configstore(packageName, defaults?, options?)\n\nReturns a new instance.\n\n#### packageName\n\nType: `string`\n\nName of your package.\n\n#### defaults\n\nType: `object`\n\nDefault config.\n\n#### options\n\nType: `object`\n\n##### globalConfigPath\n\nType: `boolean`\\\nDefault: `false`\n\nStore the config at `$CONFIG/package-name/config.json` instead of the default `$CONFIG/configstore/package-name.json`. This is not recommended as you might end up conflicting with other tools, rendering the \"without having to think\" idea moot.\n\n##### configPath\n\nType: `string`\\\nDefault: Automatic\n\n**Please don't use this option unless absolutely necessary and you know what you're doing.**\n\nSet the path of the config file. Overrides the `packageName` and `globalConfigPath` options.\n\n### Instance\n\nYou can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a `key` to access nested properties.\n\n### .set(key, value)\n\nSet an item.\n\n### .set(object)\n\nSet multiple items at once.\n\n### .get(key)\n\nGet an item.\n\n### .has(key)\n\nCheck if an item exists.\n\n### .delete(key)\n\nDelete an item.\n\n### .clear()\n\nDelete all items.\n\n### .size\n\nGet the item count.\n\n### .path\n\nGet the path to the config file. Can be used to show the user where the config file is located or even better open it for them.\n\n### .all\n\nGet all the config as an object or replace the current config with an object:\n\n```js\nconfig.all = {\n\thello: 'world'\n};\n```\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["3. Engineering","others","JavaScript","Packages","包","Uncategorized"],"sub_categories":["3.1. Cli Tools","Command-line utilities","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeoman%2Fconfigstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeoman%2Fconfigstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeoman%2Fconfigstore/lists"}