{"id":26785816,"url":"https://github.com/kscript/json-pack","last_synced_at":"2026-02-03T02:07:13.256Z","repository":{"id":268496410,"uuid":"904382830","full_name":"kscript/json-pack","owner":"kscript","description":"一个用于将json数据压缩/解压的npm模块 查看示例页面 https://kscript.github.io/json-pack/demo","archived":false,"fork":false,"pushed_at":"2024-12-23T04:52:31.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T11:34:41.309Z","etag":null,"topics":["json","json-pack","npm","pack"],"latest_commit_sha":null,"homepage":"https://kscript.github.io/json-pack/demo","language":"JavaScript","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/kscript.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-16T19:28:42.000Z","updated_at":"2024-12-23T04:52:34.000Z","dependencies_parsed_at":"2024-12-17T05:58:54.281Z","dependency_job_id":"5facfd0c-4819-4f8d-be22-ecf398e9cc60","html_url":"https://github.com/kscript/json-pack","commit_stats":null,"previous_names":["kscript/json-pack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fjson-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fjson-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fjson-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kscript%2Fjson-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kscript","download_url":"https://codeload.github.com/kscript/json-pack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249762281,"owners_count":21321905,"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":["json","json-pack","npm","pack"],"created_at":"2025-03-29T11:31:07.911Z","updated_at":"2026-02-03T02:07:08.230Z","avatar_url":"https://github.com/kscript.png","language":"JavaScript","readme":"# @kscript/json-pack\nA simple JSON packer/unpacker\n\n# example\n\n``` javascript\nconst jsonPack = require('@kscript/json-pack');\nconst user = {\n  a: 1,\n  aa: 11,\n  aaa: 111,\n  aaaa: {\n    b: 2,\n    bb: 22,\n    bbb: 222,\n    bbbb: {\n      a: 3,\n      aa: 33,\n      aa: 333\n    }\n  },\n  d: [\n    {\n      a: 1,\n      d: 4\n    },\n    {\n      aa: 11,\n      dd: 44\n    },\n    {\n      aaa: 111,\n      ddd: 444\n    },\n    {\n      aaaa: 1111,\n      dddd: 4444\n    },\n    {\n      aaaa: 1111,\n      dddd: 4444\n    },\n    {\n      aaaa: 1111,\n      dddd: 4444\n    }\n  ]\n}\n// keys的引用不会丢失, 可以是一个公共的key数组, 用于多文件压缩\n// 单文件压缩时, keys会一起压缩, 每个文件都可以直接解压\n// 多文件压缩时, keys是公共的, 动态增加的, 需要自行保存好\nconst options = { keys: [] }\nconsole.log([\n  // 压缩\n  jsonPack.compress(user),\n  // 压缩 + 解压\n  // 压缩时不传keys数组, 返回压缩后的content\n  // 传入keys数组, 返回的是[content, options]数组(与解压函数的参数一一对应)\n  jsonPack.decompress(...jsonPack.compress(user, options))\n])\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkscript%2Fjson-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkscript%2Fjson-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkscript%2Fjson-pack/lists"}