{"id":51677042,"url":"https://github.com/karmakrafts/Kompress","last_synced_at":"2026-08-03T13:00:27.143Z","repository":{"id":328520941,"uuid":"1115580231","full_name":"karmakrafts/Kompress","owner":"karmakrafts","description":"Compression and archiver APIs for Kotlin Multiplatform.","archived":false,"fork":false,"pushed_at":"2026-07-12T02:51:47.000Z","size":3002,"stargazers_count":62,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-25T19:33:20.140Z","etag":null,"topics":["api","compression","compression-library","deflate","deflate-compression","gzip","gzip-format","inflate","kotlin","kotlin-js","kotlin-jvm","kotlin-multiplatform","kotlin-native","kotlin-wasm","library","zip","zip-format","zlib"],"latest_commit_sha":null,"homepage":"https://git.karmakrafts.dev/kk/kompress","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karmakrafts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-13T06:02:47.000Z","updated_at":"2026-07-23T15:37:22.000Z","dependencies_parsed_at":"2025-12-15T13:10:47.501Z","dependency_job_id":null,"html_url":"https://github.com/karmakrafts/Kompress","commit_stats":null,"previous_names":["karmakrafts/kompress"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/karmakrafts/Kompress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FKompress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FKompress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FKompress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FKompress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karmakrafts","download_url":"https://codeload.github.com/karmakrafts/Kompress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmakrafts%2FKompress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36236079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-08-03T02:00:06.975Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","compression","compression-library","deflate","deflate-compression","gzip","gzip-format","inflate","kotlin","kotlin-js","kotlin-jvm","kotlin-multiplatform","kotlin-native","kotlin-wasm","library","zip","zip-format","zlib"],"created_at":"2026-07-15T08:00:33.481Z","updated_at":"2026-08-03T13:00:27.127Z","avatar_url":"https://github.com/karmakrafts.png","language":"Kotlin","funding_links":[],"categories":["Libraries"],"sub_categories":["📁 File"],"readme":"# 🗜️ Kompress\n\n[![](https://git.karmakrafts.dev/kk/kompress/badges/master/pipeline.svg)](https://git.karmakrafts.dev/kk/kompress/-/pipelines)\n[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.maven.apache.org%2Fmaven2%2Fdev%2Fkarmakrafts%2Fkompress%2Fkompress-core%2Fmaven-metadata.xml\n)](https://git.karmakrafts.dev/kk/kompress/-/packages)\n[![](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fdev%2Fkarmakrafts%2Fkompress%2Fkompress-core%2Fmaven-metadata.xml\n)](https://git.karmakrafts.dev/kk/kompress/-/packages)\n[![](https://img.shields.io/badge/2.4.0-blue?logo=kotlin\u0026label=kotlin)](https://kotlinlang.org/)\n[![](https://img.shields.io/badge/documentation-black?logo=kotlin)](https://docs.karmakrafts.dev/kompress-core)\n\n![](https://img.shields.io/badge/-JVM-blue?logo=kotlin\u0026labelColor=black)\n![](https://img.shields.io/badge/-Android-green?logo=kotlin\u0026labelColor=black)\n![](https://img.shields.io/badge/-Native-lightgray?logo=kotlin\u0026labelColor=black)\n![](https://img.shields.io/badge/-JS-gold?logo=kotlin\u0026labelColor=black)\n![](https://img.shields.io/badge/-WASM/JS-orange?logo=kotlin\u0026labelColor=black)\n![](https://img.shields.io/badge/-WASM/WASI-purple?logo=kotlin\u0026labelColor=black)\n\nCompression and archiver APIs for Kotlin Multiplatform.\n\n### Features\n\n- Supports all Kotlin Multiplatform targets\n- General purpose `Compressor` and `Decompressor` APIs for modeling streaming compressors\n- General purpose `Archiver\u003cE\u003e` and `Unarchiver\u003cE\u003e` APIs for modeling streaming archivers\n- Compress and decompress various data formats like **Deflate** and **Zlib**\n- Create and read various archive types, including **GZIP** and **ZIP**\n- Synchronous streaming API inspired by Java's `Inflater`/`Deflater` APIs\n- Integration with [kotlinx.io](https://github.com/Kotlin/kotlinx-io)\n- Customizable compression-level for supported (de)compressors\n- Optional SIMD acceleration on JVM using [jdk.incubator.vector](https://openjdk.org/jeps/537)\n\n### Modules\n\n- **kompress-core**: Core compression and CRC APIs, provides a common DEFLATE implementation\n- **kompress-zlib**: Support for Zlib compressed data streams\n- **kompress-gzip**: Support for the GZIP archive container format\n- **kompress-zip**: Support for the ZIP archive container format (no en-/decryption support)\n- **kompress-benchmarks**: Various benchmarks comparing Kompress implementations against platform references\n\n### How to use it\n\nFirst, add the official Maven Central repository to your settings.gradle.kts:\n\n```kotlin\ndependencyResolutionManagement {\n    repositories {\n        maven(\"https://central.sonatype.com/repository/maven-snapshots\")\n        mavenCentral()\n    }\n}\n```\n\nThen add a dependency on the library in your root buildscript:\n\n```kotlin\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(\"dev.karmakrafts.kompress:kompress-core:\u003cversion\u003e\")\n            }\n        }\n    }\n}\n```\n\nOr, if you are only using Kotlin/JVM, add it to your top-level dependencies block instead.\n\n### Inflater and Deflater interfaces\n\n#### Bulk compression\n\nIf you just want to (de)compress one large blob of data, the `Deflater.compress` and `Inflater.decompress` functions\nare what you're probably looking for:\n\n```kotlin\nfun main() {\n    val myData = \"Hello, World! This is an important message.\"\n    val compressedData = Deflater.compress(\n        data = myData.encodeToByteArray(), raw = false, // Control if you want the gzip/pkzip header\n        level = 9, // Control the compression level\n        bufferSize = 1024 // Control the internal buffer size\n    )\n    val decompressedData = Inflater.decompress(\n        data = compressedData, \n        raw = false, \n        bufferSize = 1024\n    )\n    println(myData == decompressedData.decodeToString())\n}\n```\n\n#### Streaming compression\n\nStreaming compression is what you want if your data exceeds a certain size,  \nthat size usually being the limit of the underlying runtime's array size.  \nWith Kompress, that limit is about 2.147GB because the index type of an array\nin Kotlin is a signed integer.\nStreaming allows you to split up the data into discrete chunks and compress those\nchunks sequentially until you processed all the data.\n\nYou can either use the `Deflater` and `Inflater` interfaces from the core module manually:\n\n```kotlin\nfun main() {\n    val deflater = Deflater(\n        raw = false,\n        level = 9,\n        // ...\n    )\n    val outputBuffer = ByteArray(1024)\n    while (deflater.needsInput) {\n        if (!hasMoreInput) deflater.finish() // Signal that we are done compressing\n        deflater.input = getInputChunk()\n        while (!deflater.finished) {\n            deflater.compress(outputBuffer) // Deflate data into the buffer\n            copyChunkToSomeTarget(outputBuffer)\n        }\n    }\n    deflater.close() // Always close Deflater/Inflater, it is recommended to use .use{}\n}\n```\n\nOr you can use the recommended way of using `kotlinx.io` wrappers:\n\n```kotlin\nfun main() {\n    val buffer = Buffer()\n    buffer.writeInt(42)\n    buffer.writeFloat(4.20F)\n\n    val compressedBuffer = Buffer()\n    buffer.deflatingSource().use(compressedBuffer::transferFrom)\n\n    val decompressedBuffer = Buffer()\n    compressedBuffer.inflatingSource().use(decompressedBuffer::transferFrom)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmakrafts%2FKompress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarmakrafts%2FKompress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmakrafts%2FKompress/lists"}