{"id":17037025,"url":"https://github.com/perryvw/valve-kv","last_synced_at":"2025-07-26T04:35:17.965Z","repository":{"id":57390559,"uuid":"330219731","full_name":"Perryvw/valve-kv","owner":"Perryvw","description":"Valve key value parser and serializer npm package","archived":false,"fork":false,"pushed_at":"2022-02-15T21:16:20.000Z","size":678,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-14T15:02:36.757Z","etag":null,"topics":[],"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/Perryvw.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":"2021-01-16T17:38:58.000Z","updated_at":"2024-09-24T06:52:00.000Z","dependencies_parsed_at":"2022-09-17T03:31:17.103Z","dependency_job_id":null,"html_url":"https://github.com/Perryvw/valve-kv","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Perryvw/valve-kv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perryvw%2Fvalve-kv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perryvw%2Fvalve-kv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perryvw%2Fvalve-kv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perryvw%2Fvalve-kv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Perryvw","download_url":"https://codeload.github.com/Perryvw/valve-kv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perryvw%2Fvalve-kv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267117538,"owners_count":24038677,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-14T08:52:42.468Z","updated_at":"2025-07-26T04:35:17.935Z","avatar_url":"https://github.com/Perryvw.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Valve KV for Node\nNode.js implementation of serialization and deserialization of Valve's KeyValues (KV or VDF) format.\n\nThis parser is based on [PHPValveKV](https://github.com/Perryvw/PHPValveKV).\n\n## Installation\n```\nnpm install valve-kv\n```\n\n## Example deserialize usage\nDeserialize a string\n```ts\nimport { deserialize } from \"valve-kv\";\n\nconst kv = `\"A\" \n            { \n                \"B\"  \"C\" \n            }`;\nconst kvObject = deserialize(kv);\nconst b = kvObject[\"A\"][\"B\"]; // string \"C\"\n```\n\nDeserialize a file (supports `#base` includes):\n```ts\nimport { deserializeFile } from \"valve-kv\";\n\nconst itemsFileObject = deserializeFile(\"items.txt\");\n// Default encoding is utf-8, but it can be specified\nconst utf16FileObject = deserializeFile(\"utf16File.txt\", \"utf16le\");\n```\n\n## Example serialize usage\nSerialize an object to KV:\n```ts\nimport { serialize } from \"valve-kv\";\n\nconst myObj = { A: { B: \"C\" } };\nconst kv = serialize(myObj);\n/* kv value:\n\"A\"\n{\n    \"B\"    \"C\"\n}\n*/\n```\n\nSerialize arrays to KV:\n```ts\nimport { serialize } from \"valve-kv\";\n\nconst myObj = { A: [\"C\", \"D\", \"E\"] };\nconst kv = serialize(myObj);\n/* kv value:\n\"A\"\n{\n    \"1\"    \"C\"\n    \"2\"    \"D\"\n    \"3\"    \"E\"\n}\n*/\n```\n\n## Available methods\n\n### + deserialize(kvstring, [encoding = utf8])\nDeserialize a string to a KVObject.\n\n### + deserializeFile(filepath, [encoding = utf8])\nDeserialize a file to a KVObject. This supports the usage of `#base` includes in the file.\n\n### + serialize(kvobject)\nSerialize an object to a KV string.\n\n### + isKvObject(kvValue)\nCheck if a KVValue (could be object or basic value) is a KVObject.\n\n### + arrayToKvObject(array)\nTransform an array into a KV object. Example:\n```ts\nconst kvobject = arrayToKvObject([\"A\", \"B\", \"C\"]);\n// { [\"1\"]: \"A\", [\"2\"]: \"B\", [\"3\"]: \"C\" }\n```\n\n### + arrayFromKvObject(array)\nTransform a KV object to an array. Example:\n```ts\nconst kvobject = arrayFromKvObject({ [\"1\"]: \"A\", [\"2\"]: \"B\", [\"3\"]: \"C\" });\n// [\"A\", \"B\", \"C\"]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperryvw%2Fvalve-kv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperryvw%2Fvalve-kv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperryvw%2Fvalve-kv/lists"}