{"id":30180918,"url":"https://github.com/streamich/typebase","last_synced_at":"2025-08-12T08:06:13.909Z","repository":{"id":57383287,"uuid":"58882053","full_name":"streamich/typebase","owner":"streamich","description":"C/C++ structs in Node.js","archived":false,"fork":false,"pushed_at":"2018-01-15T13:22:48.000Z","size":455,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T17:57:12.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/streamich.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":"2016-05-15T20:10:00.000Z","updated_at":"2025-05-19T12:24:55.000Z","dependencies_parsed_at":"2022-09-26T16:50:22.187Z","dependency_job_id":null,"html_url":"https://github.com/streamich/typebase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/typebase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Ftypebase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Ftypebase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Ftypebase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Ftypebase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/typebase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Ftypebase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269814002,"owners_count":24479342,"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-08-10T02:00:08.965Z","response_time":71,"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":"2025-08-12T08:06:06.125Z","updated_at":"2025-08-12T08:06:13.902Z","avatar_url":"https://github.com/streamich.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `struct` for Node.js\r\n\r\nRead `docco` docs at [here](http://streamich.github.io/typebase/). `npm` package is [here](https://www.npmjs.com/package/typebase).\r\n\r\nConsider a `C/C++` structure:\r\n\r\n```c\r\nstruct address {\r\n    int port,\r\n    unsigned char ip[4],\r\n}\r\n```\r\n\r\nDefine the same binary `struct` in JavaScript and pack/unpack data to `Buffer`:\r\n\r\n```js\r\nvar t = require('typebase');\r\n\r\nvar address = t.Struct.define([\r\n    ['port', t.i32],\r\n    ['ip', t.List.define(t.ui8, 4)]\r\n]);\r\n\r\nvar p = new t.Pointer(new Buffer(address.size), 0);\r\nvar host = {\r\n    port: 8080,\r\n    ip: [127, 0, 0, 1]\r\n};\r\naddress.pack(p, host);\r\nvar unpacked = address.unpack(p);\r\n\r\n\r\nconsole.log(unpacked);\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Ftypebase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Ftypebase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Ftypebase/lists"}