{"id":16717237,"url":"https://github.com/mseri/ocaml-clz","last_synced_at":"2025-04-10T06:42:59.257Z","repository":{"id":45025200,"uuid":"370382070","full_name":"mseri/ocaml-clz","owner":"mseri","description":"Compression support for cohttp-lwt using decompress","archived":false,"fork":false,"pushed_at":"2025-02-06T09:10:04.000Z","size":55,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T07:49:08.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.mseri.me/ocaml-clz/","language":"OCaml","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/mseri.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2021-05-24T14:32:59.000Z","updated_at":"2025-02-06T09:10:07.000Z","dependencies_parsed_at":"2022-09-02T23:23:00.870Z","dependency_job_id":null,"html_url":"https://github.com/mseri/ocaml-clz","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Focaml-clz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Focaml-clz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Focaml-clz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Focaml-clz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mseri","download_url":"https://codeload.github.com/mseri/ocaml-clz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248173397,"owners_count":21059592,"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-10-12T21:30:57.253Z","updated_at":"2025-04-10T06:42:59.231Z","avatar_url":"https://github.com/mseri.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compression support for cohttp-lwt using decompress\n\n[![CI Status](https://github.com/mseri/ocaml-clz/actions/workflows/workflow.yml/badge.svg)](https://github.com/mseri/ocaml-clz/actions/workflows/workflow.yml)\n\nThe library interface tries to stay somewhat close to\n[dream-encoding](https://github.com/tmattio/dream-encoding).\n\nUsage example:\n```ocaml\nlet get_with_compression_support ?headers uri =\n  let headers = Clz_cohttp.update_headers headers in\n  let open Lwt.Syntax in\n  let* resp, body = Cohttp_lwt_unix.Client.get ~headers uri in\n  let status = Cohttp_lwt.Response.status resp in\n  let* () = if status \u003c\u003e `OK then Cohttp_lwt.Body.drain_body body else Lwt.return_unit in\n  match status with\n  | `OK -\u003e\n    let body = Clz_cohttp.decompress (resp, body) in\n    Lwt.return body\n  | _ -\u003e Lwt.fail_with \"Not Ok\"\n```\n\nIt provides three libraries:\n- `clz`: functions to inflate and deflate strings, in case one does not need `cohttp`\n- `clz.cfg`: configuration for gzip deflate, separate only because it links `unix`\n- `clz.cohttp`: provides the module {!Clz_cohttp}, which contains helpers to add the necessary accept headers and to decompress the response bodies.\n\nThe documentation can be found on [www.mseri.me/ocaml-clz/](https://www.mseri.me/ocaml-clz/).\n\n## Why CLZ\n\nThe name was supposed to be temporary.\nStarted as `CUZ: Cohttp U gZip`, but it really only supports `cohttp-lwt`, so it changed into `CLS: Cohttp-Lwt-Zip`, even if it supports both gzip and deflate.\nI use it in a lot of scripts now, more invasive changes would be way too time-consuming :P\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmseri%2Focaml-clz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmseri%2Focaml-clz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmseri%2Focaml-clz/lists"}