{"id":19189332,"url":"https://github.com/maxiy01/tstl-binser","last_synced_at":"2026-04-25T08:34:45.927Z","repository":{"id":57381848,"uuid":"434188352","full_name":"maxiy01/tstl-binser","owner":"maxiy01","description":"Declarations for binser, Customizable Lua Serializer.","archived":false,"fork":false,"pushed_at":"2021-12-02T11:15:14.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T03:01:55.390Z","etag":null,"topics":["binser","lua","serialization","serialization-library","typescript","typescript-to-lua"],"latest_commit_sha":null,"homepage":"","language":null,"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/maxiy01.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-12-02T11:10:26.000Z","updated_at":"2022-07-18T10:01:16.000Z","dependencies_parsed_at":"2022-09-13T11:30:58.493Z","dependency_job_id":null,"html_url":"https://github.com/maxiy01/tstl-binser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maxiy01/tstl-binser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxiy01%2Ftstl-binser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxiy01%2Ftstl-binser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxiy01%2Ftstl-binser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxiy01%2Ftstl-binser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxiy01","download_url":"https://codeload.github.com/maxiy01/tstl-binser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxiy01%2Ftstl-binser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263437174,"owners_count":23466362,"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":["binser","lua","serialization","serialization-library","typescript","typescript-to-lua"],"created_at":"2024-11-09T11:29:03.500Z","updated_at":"2026-04-25T08:34:45.882Z","avatar_url":"https://github.com/maxiy01.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# TSTL binser\n\nDeclarations for [binser](https://github.com/bakpakin/binser), Customizable Lua Serializer.\n\n\n| Command | Description |\n|-|-|\n| `yarn add -D tstl-binser` | Install these declarations |\n| `yarn add bakpakin/binser` | Install binser |\n\n\nUpon installation these declarations can be linked to a _tsconfig.json_ file.\n\n```json\n{\n    \"compilerOptions\": {\n        \"types\": [\n            \"tstl-binser\"\n        ]\n    }\n}\n```\n\nAnd used within any _.ts_ file.\n\n```ts\nimport * as binser from \"binser\";\n\nclass Vec2\n{\n    constructor(public x: number, public y: number)\n    {\n    }\n}\n\n// use binser.registerClass for automatic class serialization\nbinser.registerClass(Vec2.prototype,Vec2.name);\n\n// or binser.register for custom serializers and deserializers\nbinser.register\u003cVec2,[number,number]\u003e(Vec2.prototype, Vec2.name,\n    //serialize()\n    (v: Vec2) =\u003e {\n        return $multi(v.x, v.y)\n    },\n    //deserialize\n    (x: number, y: number) =\u003e {\n        return new Vec2(x,y)\n    }\n)\n\n\nlet original: Vec2 = new Vec2(42, 1234);\nlet serialized: string = binser.serialize(original);\nlet deserialized: Vec2;\n[deserialized] = binser.deserializeN(serialized, 1);\n\nif(original.x === deserialized.x \u0026\u0026 original.y === deserialized.y)\n    print('original === deserialized');\n```\n\nMake sure to append `\";./node_modules/tiny-ecs/?.lua\"` to your `package.path` in a _conf.ts_ file (this is run first) to assist where Lua looks for modules.\n\n```ts\npackage.path += \";./node_modules/?/?.lua\";\n```\n\nAlso you need to add `\"typescript-to-lua/language-extensions\"` to _tsconfig.json_ file.\n```json\n{\n    \"compilerOptions\": {\n        \"types\": [\n            \"typescript-to-lua/language-extensions\"\n        ]\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxiy01%2Ftstl-binser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxiy01%2Ftstl-binser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxiy01%2Ftstl-binser/lists"}