{"id":20481593,"url":"https://github.com/tsfoster/elm-bytes-extra","last_synced_at":"2025-07-16T08:39:23.264Z","repository":{"id":57674710,"uuid":"219989682","full_name":"TSFoster/elm-bytes-extra","owner":"TSFoster","description":"Helpers for working with elm/bytes","archived":false,"fork":false,"pushed_at":"2020-01-09T16:10:46.000Z","size":51,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T04:13:01.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/TSFoster/elm-bytes-extra/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TSFoster.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":"2019-11-06T12:17:41.000Z","updated_at":"2021-12-14T11:22:20.000Z","dependencies_parsed_at":"2022-09-11T16:31:59.536Z","dependency_job_id":null,"html_url":"https://github.com/TSFoster/elm-bytes-extra","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-bytes-extra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-bytes-extra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-bytes-extra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-bytes-extra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TSFoster","download_url":"https://codeload.github.com/TSFoster/elm-bytes-extra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242058081,"owners_count":20065062,"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":[],"created_at":"2024-11-15T16:09:03.412Z","updated_at":"2025-03-05T15:44:16.478Z","avatar_url":"https://github.com/TSFoster.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-bytes-extra\n\nThis package provides a few helper functions to augment the functionality of\n[elm/bytes].\n\n## Examples\n\n```elm\nimport Bytes exposing (Bytes, Endianness(..))\nimport Bytes.Extra\nimport Bytes.Decode as Decode exposing (Decoder)\nimport Bytes.Decode.Extra exposing (andMap, hardcoded)\nimport Bytes.Encode as Encode\nimport Bytes.Encode.Extra\n\n\nstringToBytes : String -\u003e List Int\nstringToBytes =\n    Encode.string \u003e\u003e Encode.encode \u003e\u003e Bytes.Extra.toByteValues\n\n\nstringToBytes \"Hello world!\"\n--\u003e [ 0x48, 0x65, 0x6c, 0x6c\n--\u003e , 0x6f, 0x20, 0x77, 0x6f\n--\u003e , 0x72, 0x6c, 0x64, 0x21\n--\u003e ]\n\n\n--\n\n\ntype Status = FromRemote | FromLocal\n\ntype alias MyData =\n  { count : Int\n  , title : String\n  , status : Status\n  , weighting : Float\n  }\n\nmyDataDecoder : Decoder MyData\nmyDataDecoder =\n    Decode.succeed MyData\n        |\u003e andMap (Decode.unsignedInt16 BE)\n        |\u003e andMap (Decode.unsignedInt16 BE |\u003e Decode.andThen Decode.string)\n        |\u003e hardcoded FromRemote\n        |\u003e andMap (Decode.float64 BE)\n\n\nDecode.decode myDataDecoder \u003c|\n    Encode.encode \u003c| Encode.sequence\n        [ Encode.unsignedInt16 BE 12\n        , Encode.unsignedInt16 BE (String.length \"Metric A\")\n        , Encode.string \"Metric A\"\n        , Encode.float64 BE 0.234\n        ]\n--\u003e Just\n--\u003e     { count = 12\n--\u003e     , title = \"Metric A\"\n--\u003e     , status = FromRemote\n--\u003e     , weighting = 0.234\n--\u003e     }\n\n\n--\n\ntype MyData2 = MyData2 Int Int Int Int Int Int Int Int\n\nmyData2Decoder : Decoder MyData2\nmyData2Decoder =\n    Bytes.Decode.Extra.map8 MyData2\n        (Decode.unsignedInt16 LE) (Decode.unsignedInt16 LE)\n        (Decode.unsignedInt16 LE) (Decode.unsignedInt16 LE)\n        (Decode.unsignedInt16 LE) (Decode.unsignedInt16 LE)\n        (Decode.unsignedInt16 LE) (Decode.unsignedInt16 LE)\n\nDecode.decode myData2Decoder \u003c|\n    Encode.encode \u003c| Bytes.Encode.Extra.list (Encode.unsignedInt16 LE) [1, 2, 3, 4, 5, 6, 7, 8]\n--\u003e Just (MyData2 1 2 3 4 5 6 7 8)\n```\n\n## Feedback and contributing\n\nFeedback, suggestions and contributions are welcome. Please raise an [issue on\nGithub][new-issue], or [create a pull request][pull-requests].\n\n[elm/bytes]: https://package.elm-lang.org/packages/elm/bytes/latest/\n[new-issue]: https://github.com/TSFoster/elm-bytes-extra/issues/new\n[pull-requests]: https://github.com/TSFoster/elm-bytes-extra/pulls\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsfoster%2Felm-bytes-extra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsfoster%2Felm-bytes-extra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsfoster%2Felm-bytes-extra/lists"}