{"id":15957146,"url":"https://github.com/mamantoha/crystal-bplist","last_synced_at":"2025-04-04T09:29:45.557Z","repository":{"id":216112279,"uuid":"737778870","full_name":"mamantoha/crystal-bplist","owner":"mamantoha","description":"Generate and parse Apple binary .plist files with Crystal","archived":false,"fork":false,"pushed_at":"2025-01-12T14:47:30.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-09T20:16:29.141Z","etag":null,"topics":["bplist","crystal"],"latest_commit_sha":null,"homepage":"https://mamantoha.github.io/crystal-bplist/","language":"Crystal","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/mamantoha.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-01T13:20:33.000Z","updated_at":"2025-01-12T14:47:10.000Z","dependencies_parsed_at":"2024-01-08T15:24:51.241Z","dependency_job_id":"1bd4d04f-c907-48e2-98ce-696cf4db5e25","html_url":"https://github.com/mamantoha/crystal-bplist","commit_stats":null,"previous_names":["mamantoha/crystal-bplist"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fcrystal-bplist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fcrystal-bplist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fcrystal-bplist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mamantoha%2Fcrystal-bplist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mamantoha","download_url":"https://codeload.github.com/mamantoha/crystal-bplist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247152450,"owners_count":20892494,"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":["bplist","crystal"],"created_at":"2024-10-07T13:40:41.473Z","updated_at":"2025-04-04T09:29:45.527Z","avatar_url":"https://github.com/mamantoha.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crystal-bplist\n\n[![Crystal CI](https://github.com/mamantoha/crystal-bplist/actions/workflows/crystal.yml/badge.svg)](https://github.com/mamantoha/crystal-bplist/actions/workflows/crystal.yml)\n[![GitHub release](https://img.shields.io/github/release/mamantoha/crystal-bplist.svg)](https://github.com/mamantoha/crystal-bplist/releases)\n[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://mamantoha.github.io/crystal-bplist/)\n[![License](https://img.shields.io/github/license/mamantoha/crystal-bplist.svg)](https://github.com/mamantoha/crystal-bplist/blob/main/LICENSE)\n\nApple's binary property list format implementation in Crystal.\n\n`bplist` module provides an interface for reading and writing the “property list” files used by Apple, primarily on macOS and iOS.\nThis module supports only binary plist files.\n\nValues can be strings, integers, floats, booleans, arrays, hashes (but only with string keys), `Bytes`, or `Time` objects.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     bplist:\n       github: mamantoha/crystal-bplist\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n### `Bplist::Writer`\n\nTransform a Crystal hash into bplist format:\n\n```crystal\nrequire \"bplist\"\n\nhash = {\n  \"ExampleDictionary\" =\u003e {\n    \"ExampleDate\" =\u003e Time.parse(\"2023-04-01 12:00:00 +00:00\", \"%Y-%m-%d %H:%M:%S %z\", Time::Location::UTC),\n    \"ExampleArray\" =\u003e [\n      \"Item 1\",\n      \"Item 2\",\n      \"Item 3\",\n    ],\n  },\n  \"ExampleString\" =\u003e \"Hello, world!\",\n  \"ExampleInteger\" =\u003e 42,\n  \"ExampleBoolean\" =\u003e true,\n}\n\nwriter = Bplist::Writer.new(hash)\nwriter.write_to_file(\"#{__DIR__}/../assets/example_mod.plist\")\n```\n\n```sh\ncrystal ./samples/write.cr\n```\n\nRewrite the property list file in XML format:\n\n```sh\nplutil -convert xml1 assets/example_mod.plist -o assets/example_mod.xml\ncat assets/example_mod.xml\n```\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003eExampleBoolean\u003c/key\u003e\n\t\u003ctrue/\u003e\n\t\u003ckey\u003eExampleDictionary\u003c/key\u003e\n\t\u003cdict\u003e\n\t\t\u003ckey\u003eExampleArray\u003c/key\u003e\n\t\t\u003carray\u003e\n\t\t\t\u003cstring\u003eItem 1\u003c/string\u003e\n\t\t\t\u003cstring\u003eItem 2\u003c/string\u003e\n\t\t\t\u003cstring\u003eItem 3\u003c/string\u003e\n\t\t\u003c/array\u003e\n\t\t\u003ckey\u003eExampleDate\u003c/key\u003e\n\t\t\u003cdate\u003e2023-04-01T12:00:00Z\u003c/date\u003e\n\t\u003c/dict\u003e\n\t\u003ckey\u003eExampleInteger\u003c/key\u003e\n\t\u003cinteger\u003e42\u003c/integer\u003e\n\t\u003ckey\u003eExampleString\u003c/key\u003e\n\t\u003cstring\u003eHello, world!\u003c/string\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\n### `Bplist::Parser`\n\nParse a binary plist file and retrieve a `Bplist::Any` object:\n\n```crystal\nrequire \"bplist\"\n\nbplist = Bplist::Parser.new(\"#{__DIR__}/../assets/example.plist\")\n\nresult = bplist.parse\npp result\n```\n\n```crystal\n{\"ExampleDictionary\" =\u003e\n  {\"ExampleDate\" =\u003e 2023-04-01 12:00:00.0 UTC,\n   \"ExampleArray\" =\u003e [\"Item 1\", \"Item 2\", \"Item 3\"]},\n \"ExampleString\" =\u003e \"Hello, world!\",\n \"ExampleInteger\" =\u003e 42,\n \"ExampleBoolean\" =\u003e true}\n```\n\n## Useful links\n\n- https://medium.com/@karaiskc/understanding-apples-binary-property-list-format-281e6da00dbd\n- https://opensource.apple.com/source/CF/CF-635/CFBinaryPList.c.auto.html\n- https://docs.python.org/3/library/plistlib.html\n- https://github.com/python/cpython/blob/main/Lib/plistlib.py\n- http://fileformats.archiveteam.org/wiki/Property_List/Binary\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/mamantoha/crystal-bplist/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmamantoha%2Fcrystal-bplist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmamantoha%2Fcrystal-bplist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmamantoha%2Fcrystal-bplist/lists"}