{"id":16832651,"url":"https://github.com/zswang/jpacks","last_synced_at":"2025-03-22T04:30:40.349Z","repository":{"id":57142544,"uuid":"45185861","full_name":"zswang/jpacks","owner":"zswang","description":"Binary data packing and unpacking.","archived":false,"fork":false,"pushed_at":"2017-06-19T15:34:43.000Z","size":216,"stargazers_count":56,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T08:11:14.460Z","etag":null,"topics":["cstruct","packer","protobuffer","unpack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zswang.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}},"created_at":"2015-10-29T13:46:08.000Z","updated_at":"2024-02-20T06:09:07.000Z","dependencies_parsed_at":"2022-09-05T18:41:33.315Z","dependency_job_id":null,"html_url":"https://github.com/zswang/jpacks","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Fjpacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Fjpacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Fjpacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zswang%2Fjpacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zswang","download_url":"https://codeload.github.com/zswang/jpacks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244907420,"owners_count":20529850,"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":["cstruct","packer","protobuffer","unpack"],"created_at":"2024-10-13T11:49:53.861Z","updated_at":"2025-03-22T04:30:40.033Z","avatar_url":"https://github.com/zswang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coverage-image]][coverage-url]\n\n# jpacks\n\nBinary data packing and unpacking.\n\njpacks 一款强大的二进制结构编解码工具\n\n支持复杂的结构：\n\ne.g.\n\n```js\n// 定义结构\njpacks.def('User', {\n  age: 'uint8',\n  token: jpacks.array('byte', 10),\n  name: jpacks.shortString,\n  note: jpacks.longString,\n  contacts: jpacks.shortArray('User')\n});\n\nvar user = {\n  age: 6,\n  token: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n  name: 'ss',\n  note: '你好世界！Hello World!',\n  contacts: [{\n    age: 10,\n    token: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n    name: 'nn',\n    note: '风一样的孩子!The wind of the children!',\n    contacts: [{\n      age: 12,\n      token: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n      name: 'zz',\n      note: '圣斗士星矢！Saint Seiya！',\n      contacts: []\n    }]\n  }, {\n    age: 8,\n    token: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n    name: 'cc',\n    note: '快乐的小熊！Happy bear！',\n    contacts: []\n  }]\n};\n\n// 组包\nvar buffer = jpacks.pack('User', user);\n\n// 解包\nvar user2 = jpacks.unpack('User', buffer);\n\nconsole.log(JSON.stringify(user2, null, '  '));\n```\n\n## Features 功能性\n\n+ Supports running in NodeJS and Browser. 支持运行在 NodeJS 和浏览器环境。\n+ Can be nested definition. 支持嵌套定义。\n+ Commonly used numerical types, including signed and unsigned. 常用的数值类型，包括有符号和无符号。\n+ Supports array types, including fixed length or indefinite. 支持数组类型，包括定长或不定长。\n+ Int64. 大整数处理。\n+ Protocol Buffers. 支持处理 PB 协议。\n+ Data compression and decompression. 数据压缩和解压。\n\n## Dependencies 依赖\n\n+ [protobufjs](https://github.com/dcodeIO/protobuf.js)\n+ [long](https://github.com/dcodeIO/long.js)\n\n## License 许可协议\n\nMIT © [zswang](http://weibo.com/zswang)\n\n[npm-url]: https://npmjs.org/package/jpacks\n[npm-image]: https://badge.fury.io/js/jpacks.svg\n[travis-url]: https://travis-ci.org/zswang/jpacks\n[travis-image]: https://travis-ci.org/zswang/jpacks.svg?branch=master\n[coverage-url]: https://coveralls.io/github/zswang/jpacks?branch=master\n[coverage-image]: https://coveralls.io/repos/zswang/jpacks/badge.svg?branch=master\u0026service=github\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzswang%2Fjpacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzswang%2Fjpacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzswang%2Fjpacks/lists"}