{"id":15496028,"url":"https://github.com/lemarier/deno-conf","last_synced_at":"2026-05-17T03:08:31.154Z","repository":{"id":57675319,"uuid":"265921245","full_name":"lemarier/deno-conf","owner":"lemarier","description":"Simple config handling for your app or module with Deno.","archived":false,"fork":false,"pushed_at":"2020-05-21T23:17:36.000Z","size":5,"stargazers_count":0,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T22:49:26.083Z","etag":null,"topics":["config","configuration-files","configuration-management","deno"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lemarier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-21T18:20:22.000Z","updated_at":"2022-07-23T04:22:08.000Z","dependencies_parsed_at":"2022-09-05T22:40:56.639Z","dependency_job_id":null,"html_url":"https://github.com/lemarier/deno-conf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemarier%2Fdeno-conf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemarier%2Fdeno-conf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemarier%2Fdeno-conf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemarier%2Fdeno-conf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemarier","download_url":"https://codeload.github.com/lemarier/deno-conf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068306,"owners_count":20718503,"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":["config","configuration-files","configuration-management","deno"],"created_at":"2024-10-02T08:21:45.650Z","updated_at":"2026-05-17T03:08:26.110Z","avatar_url":"https://github.com/lemarier.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conf\n\nSimple config handling for your app or module\n\n[![Test CI](https://github.com/lemarier/deno-conf/workflows/Test%20CI/badge.svg)](https://github.com//lemarier/deno-conf/actions)\n\n```ts\nimport Conf from \"https://deno.land/x/conf/mod.ts\";\n\nconst config = new Conf({\n    projectName: \"test\"\n});\n\nconfig.set(\"unicorn\", \"🦄\");\nconsole.log(config.get(\"unicorn\"));\n//=\u003e '🦄'\n\nconfig.delete(\"unicorn\");\nconsole.log(config.get(\"unicorn\"));\n//=\u003e undefined\n```\n\n## API\n\nChanges are written to disk atomically, so if the process crashes during a write, it will not corrupt the existing config.\n\n### Conf(options?)\n\nReturns a new instance.\n\n### options\n\nType: `object`\n\n#### defaults\n\nType: `object`\n\nDefault values for the config items.\n\n#### configName\n\nType: `string`\\\nDefault: `'config'`\n\nName of the config file (without extension).\n\nUseful if you need multiple config files for your app or module. For example, different config files between two major versions.\n\n#### projectName\n\nType: `string`\\\n\\*Required\n\n#### cwd\n\nType: `string`\\\nDefault: System default [user config directory](https://github.com/lemarier/deno-env-paths#pathsconfig)\n\n**You most likely don't need this. Please don't use it unless you really have to. By default, it will pick the optimal location by adhering to system conventions. You are very likely to get this wrong and annoy users.**\n\nOverrides `projectName`.\n\nThe only use-case I can think of is having the config located in the app directory or on some external storage.\n\n#### fileExtension\n\nType: `string`\\\nDefault: `'json'`\n\nExtension of the config file.\n\nYou would usually not need this, but could be useful if you want to interact with a file with a custom file extension that can be associated with your app. These might be simple save/export/preference files that are intended to be shareable or saved outside of the app.\n\n#### clearInvalidConfig\n\nType: `boolean`\\\nDefault: `true`\n\nThe config is cleared if reading the config file causes a `SyntaxError`. This is a good default, as the config file is not intended to be hand-edited, so it usually means the config is corrupt and there's nothing the user can do about it anyway. However, if you let the user edit the config file directly, mistakes might happen and it could be more useful to throw an error when the config is invalid instead of clearing. Disabling this option will make it throw a `SyntaxError` on invalid config instead of clearing.\n\n#### serialize\n\nType: `Function`\\\nDefault: `value =\u003e JSON.stringify(value, null, '\\t')`\n\nFunction to serialize the config object to a UTF-8 string when writing the config file.\n\nYou would usually not need this, but it could be useful if you want to use a format other than JSON.\n\n#### deserialize\n\nType: `Function`\\\nDefault: `JSON.parse`\n\nFunction to deserialize the config object from a UTF-8 string when reading the config file.\n\nYou would usually not need this, but it could be useful if you want to use a format other than JSON.\n\n#### projectSuffix\n\nType: `string`\\\nDefault: `'deno'`\n\n**You most likely don't need this. Please don't use it unless you really have to.**\n\nSuffix appended to `projectName` during config file creation to avoid name conflicts with native apps.\n\nFor example, on macOS, the config file will be stored in the `~/Library/Preferences/foo-deno` directory, where `foo` is the `projectName`.\n\n### Instance\n\nThe instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.\n\n#### .set(key, value)\n\nSet an item.\n\nThe `value` must be JSON serializable. Trying to set the type `undefined`, `function`, or `symbol` will result in a TypeError.\n\n#### .set(object)\n\nSet multiple items at once.\n\n#### .get(key, defaultValue?)\n\nGet an item or `defaultValue` if the item does not exist.\n\n#### .reset(...keys)\n\nReset items to their default values, as defined by the `defaults` or `schema` option.\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#### .store\n\nGet all the config as an object or replace the current config with an object:\n\n```js\nconf.store = {\n  hello: \"world\",\n};\n```\n\n#### .path\n\nGet the path to the config file.\n\n---\n\nInspired by [conf](https://github.com/sindresorhus/conf) from [sindresorhus](https://github.com/sindresorhus).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemarier%2Fdeno-conf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemarier%2Fdeno-conf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemarier%2Fdeno-conf/lists"}