{"id":23948581,"url":"https://github.com/propan/clj-struct","last_synced_at":"2025-07-05T18:08:20.690Z","repository":{"id":8150608,"uuid":"9570556","full_name":"propan/clj-struct","owner":"propan","description":"packs/unpacks sequences of values according to the given format","archived":false,"fork":false,"pushed_at":"2013-04-23T20:58:26.000Z","size":164,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T18:58:28.428Z","etag":null,"topics":["clojure","struct"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","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/propan.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":"2013-04-20T20:56:52.000Z","updated_at":"2020-04-24T09:58:57.000Z","dependencies_parsed_at":"2022-09-25T06:22:04.115Z","dependency_job_id":null,"html_url":"https://github.com/propan/clj-struct","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/propan/clj-struct","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fclj-struct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fclj-struct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fclj-struct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fclj-struct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propan","download_url":"https://codeload.github.com/propan/clj-struct/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fclj-struct/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263781563,"owners_count":23510487,"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":["clojure","struct"],"created_at":"2025-01-06T10:19:35.838Z","updated_at":"2025-07-05T18:08:20.663Z","avatar_url":"https://github.com/propan.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-struct\n\nA simple Clojure library that packs/unpacks sequences of values to/from byte buffers.\nThe library was inspired by Python [struct] [1] module.\n\n## Usage\n\nInclude the library in your leiningen project dependencies:\n\n```clojure\n[clj-struct \"0.1.0-SNAPSHOT\"]\n```\n\n## Supported Format Characters\n\n| Format |        C Type      | Clojure type | Size |\n| ------ | ------------------ | ------------ | ---- |\n| c      | char               | char         |  1   |\n| b\t     | signed char        | byte         |  1   |\n| B      | unsigned char      | int          |  1   |\n| ?      | _Bool              | boolean      |  1   |\n| h      | short              | short        |  2   |\n| H      | unsigned short     | int          |  2   |\n| i      | int                | int          |  4   |\n| I      | unsigned int       | long         |  4   |\n| l      | long               | int          |  4   |\n| L      | unsigned long      | long         |  4   |\n| q      | long long          | long         |  8   |\n| Q      | unsigned long long | BigInt       |  8   |\n| f      | float              | float        |  4   |\n| d      | double             | double       |  8   |\n| s      | char[]             | string       |      |\n\n## Examples\n\n```clojure\n(use 'clj-struct.core)\n\n; calculates the size of the struct corresponding to the given format\n(calc-size \"11sii?\")\n\n; returns a byte buffer containing the values packed according to the given format\n(def bytes-buf (pack \"11sii?\" [\"some string\" -28 499 false]))\n\n; returns a sequence of unpacked values\n(def unpacked-seq (unpack \"11sii?\" bytes-buf))\n\n; reads first 30 integers from a binary file\n(with-open [file (RandomAccessFile. \"/path/to/file\" \"r\")]\n  (unpack \"30i\" file))\n```\n\n## License\n\nCopyright © 2013 Pavel Prokopenko\n\nDistributed under the Eclipse Public License, the same as Clojure.\n\n[1]: http://docs.python.org/2/library/struct.html \"struct - Interpret strings as packed binary data\"","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropan%2Fclj-struct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropan%2Fclj-struct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropan%2Fclj-struct/lists"}