{"id":16346471,"url":"https://github.com/milesgranger/cramjam","last_synced_at":"2025-12-12T00:54:11.675Z","repository":{"id":38094991,"uuid":"245773040","full_name":"milesgranger/cramjam","owner":"milesgranger","description":"Your go-to for easy access to a plethora of compression algorithms, all neatly bundled in one simple installation.","archived":false,"fork":false,"pushed_at":"2024-04-23T07:23:06.000Z","size":56149,"stargazers_count":78,"open_issues_count":8,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-24T04:47:32.676Z","etag":null,"topics":["brotli","bzip2","compression","decompression","deflate","gzip","lz4","python","rust","snappy","zstd"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/milesgranger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["milesgranger"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-03-08T07:46:33.000Z","updated_at":"2024-05-03T10:00:22.026Z","dependencies_parsed_at":"2024-01-08T16:21:57.830Z","dependency_job_id":"d989c31c-2762-4fe3-b122-0f0b22a43e5e","html_url":"https://github.com/milesgranger/cramjam","commit_stats":{"total_commits":101,"total_committers":7,"mean_commits":"14.428571428571429","dds":0.306930693069307,"last_synced_commit":"91a329fd1e4c8dbabc484ec1d711a20add2fcc65"},"previous_names":["milesgranger/cramjam","milesgranger/pyrus-cramjam"],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fcramjam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fcramjam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fcramjam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesgranger%2Fcramjam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milesgranger","download_url":"https://codeload.github.com/milesgranger/cramjam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221573428,"owners_count":16845835,"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":["brotli","bzip2","compression","decompression","deflate","gzip","lz4","python","rust","snappy","zstd"],"created_at":"2024-10-11T00:35:25.181Z","updated_at":"2025-12-12T00:54:11.667Z","avatar_url":"https://github.com/milesgranger.png","language":"Rust","readme":"# cramjam\n\n[![CI](https://github.com/milesgranger/cramjam/actions/workflows/CI.yml/badge.svg)](https://github.com/milesgranger/cramjam/actions/workflows/CI.yml)\n[![Downloads](https://pepy.tech/badge/cramjam/month)](https://pepy.tech/project/cramjam)\n[![PyPI](https://img.shields.io/pypi/v/cramjam.svg)](https://pypi.org/project/cramjam)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/cramjam.svg)](https://anaconda.org/conda-forge/cramjam)\n[![NPM Version](https://img.shields.io/npm/v/cramjam)](https://www.npmjs.com/package/cramjam)\n\n\n[API Documentation](https://milesgranger.github.io/cramjam/cramjam.html)\n\n### Install (Python)\n```commandline\npip install --upgrade cramjam  # Requires no Python or system dependencies!\n```\n\n\n### Install (JavaScript / TypeScript)\n```commandline\nnpm install cramjam\n```\n\n### CLI\n\nA CLI interface is available as [`cramjam-cli`](https://github.com/cramjam/cramjam-cli)\n\n### libcramjam\n\nA Rust crate and C friendly library available at [libcramjam](https://github.com/cramjam/libcramjam)\n\n---\n\nExtremely thin and easy-to-install Python bindings to de/compression algorithms in Rust.\nAllows for using algorithms such as Snappy, without any system or other python dependencies.\n\n---\n\n##### Benchmarks\n\nSome basic benchmarks are available [in the benchmarks directory](./benchmarks/README.md)\n\n---\n\nAvailable algorithms:\n\n- [X] Snappy\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.snappy`\n- [X] Brotli\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.brotli`\n- [X] Bzip2\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.bzip2`\n- [X] Lz4\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.lz4`\n- [X] Gzip\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.gzip`\n- [X] Zlib\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.zlib`\n- [X] Deflate\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.deflate`\n- [X] ZSTD\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.zstd`\n- [X] XZ / LZMA\u0026nbsp;\u0026nbsp;`cramjam.xz`\n\n\nExperimental (Requires build from source enabling each feature):\n\n- [X] Blosc2\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.experimental.blosc2`\n- [X] ISA-L backend  _(only on 64-bit targets)_\n  - [X] igzip\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.experimental.igzip`\n  - [X] ideflate\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.experimental.ideflate`\n  - [X] izlib\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`cramjam.experimental.izlib`\n\nAll available for use as:\n\n```python\n\u003e\u003e\u003e import cramjam\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e compressed = cramjam.snappy.compress(b\"bytes here\")\n\u003e\u003e\u003e decompressed = cramjam.snappy.decompress(compressed)\n\u003e\u003e\u003e decompressed\ncramjam.Buffer(len=10)  # an object which implements the buffer protocol\n\u003e\u003e\u003e bytes(decompressed)\nb\"bytes here\"\n\u003e\u003e\u003e np.frombuffer(decompressed, dtype=np.uint8)\narray([ 98, 121, 116, 101, 115,  32, 104, 101, 114, 101], dtype=uint8)\n```\n\nWhere the API is `cramjam.\u003ccompression-variant\u003e.compress/decompress` and accepts \n`bytes`/`bytearray`/`numpy.array`/`cramjam.File`/`cramjam.Buffer` / `memoryview` objects.\n\n**de/compress_into**\nAdditionally, all variants support `decompress_into` and `compress_into`. \nEx.\n```python\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e from cramjam import snappy, Buffer\n\u003e\u003e\u003e\n\u003e\u003e\u003e data = np.frombuffer(b'some bytes here', dtype=np.uint8)\n\u003e\u003e\u003e data\narray([115, 111, 109, 101,  32,  98, 121, 116, 101, 115,  32, 104, 101,\n       114, 101], dtype=uint8)\n\u003e\u003e\u003e\n\u003e\u003e\u003e compressed = Buffer()\n\u003e\u003e\u003e snappy.compress_into(data, compressed)\n33  # 33 bytes written to compressed buffer\n\u003e\u003e\u003e\n\u003e\u003e\u003e compressed.tell()  # Where is the buffer position?\n33  # goodie!\n\u003e\u003e\u003e\n\u003e\u003e\u003e compressed.seek(0)  # Go back to the start of the buffer so we can prepare to decompress\n\u003e\u003e\u003e decompressed = b'0' * len(data)  # let's write to `bytes` as output\n\u003e\u003e\u003e decompressed\nb'000000000000000'\n\u003e\u003e\u003e\n\u003e\u003e\u003e snappy.decompress_into(compressed, decompressed)\n15  # 15 bytes written to decompressed\n\u003e\u003e\u003e decompressed\nb'some bytes here'\n```\n\n\n[TypeScript](./cramjam-js/README.md):\n\n\n```typescript\n\nimport {Compress, Decompress} from 'cramjam';\n\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\n\nconst str = 'hello, world';\nconst encoded = encoder.encode(str);\n\nconst compressed = Compress.brotli(encoded);\nconst decompressed = Decompress.brotli(compressed);\n\nconst decoded = decoder.decode(decompressed);\n\n```\n","funding_links":["https://github.com/sponsors/milesgranger"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesgranger%2Fcramjam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilesgranger%2Fcramjam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesgranger%2Fcramjam/lists"}