{"id":17103022,"url":"https://github.com/helpermethod/zip-forge","last_synced_at":"2025-06-13T23:40:47.865Z","repository":{"id":154639034,"uuid":"622862670","full_name":"helpermethod/zip-forge","owner":"helpermethod","description":"A tiny, formatter-friendly Java DSL for creating ZIP files.","archived":false,"fork":false,"pushed_at":"2025-04-30T13:48:11.000Z","size":187,"stargazers_count":37,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-30T15:06:05.358Z","etag":null,"topics":["dsl","groovy","java","java-8","kotlin","zipfile"],"latest_commit_sha":null,"homepage":"","language":"Java","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/helpermethod.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,"zenodo":null}},"created_at":"2023-04-03T08:06:47.000Z","updated_at":"2025-04-30T13:48:14.000Z","dependencies_parsed_at":"2023-09-29T21:51:59.551Z","dependency_job_id":"4938935f-a441-41e1-a50b-827b1c23ca65","html_url":"https://github.com/helpermethod/zip-forge","commit_stats":{"total_commits":116,"total_committers":4,"mean_commits":29.0,"dds":0.3362068965517241,"last_synced_commit":"2a4dd3c1f72f692f0016db9b03f7f68837674eb1"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/helpermethod/zip-forge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fzip-forge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fzip-forge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fzip-forge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fzip-forge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpermethod","download_url":"https://codeload.github.com/helpermethod/zip-forge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Fzip-forge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259737639,"owners_count":22903843,"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":["dsl","groovy","java","java-8","kotlin","zipfile"],"created_at":"2024-10-14T15:31:07.122Z","updated_at":"2025-06-13T23:40:47.788Z","avatar_url":"https://github.com/helpermethod.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌋 ZIP Forge\n\n[![CI](https://github.com/helpermethod/zip-forge/actions/workflows/ci.yml/badge.svg)](https://github.com/helpermethod/zip-forge/actions/workflows/ci.yml)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=io.github.helpermethod%3Azip-forge\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=io.github.helpermethod%3Azip-forge)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=io.github.helpermethod%3Azip-forge\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=io.github.helpermethod%3Azip-forge)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=io.github.helpermethod%3Azip-forge\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=io.github.helpermethod%3Azip-forge)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=io.github.helpermethod%3Azip-forge\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=io.github.helpermethod%3Azip-forge)\n\nA tiny, formatter-friendly Java DSL for creating ZIP files.\n\n# :sparkles: Features\n\n## :pinching_hand: Tiny\n\nThe ZIP Forge API consists of only 3 methods.\n\n## :clipboard: Formatter-friendly\n\nApplying a code formatter like [palantir-java-format](https://github.com/palantir/palantir-java-format) won't mess up ZIP Forge's indentation.\n\n## :package: No external dependencies\n\nZIP Forge is based on Java's [ZIP File System Provider](https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/zipfilesystemprovider.html) and requires no external dependencies.\n\n## :jigsaw: Modular\n\nZIP Forge is published as a Java 9 module but compatible with Java 8.\n\n# :hammer_and_wrench: Installation\n\n## Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.helpermethod\u003c/groupId\u003e\n    \u003cartifactId\u003ezip-forge\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Gradle\n\n```groovy\nimplementation 'io.github.helpermethod:zip-forge:1.0.1'\n```\n\n## Gradle (Kotlin)\n\n```kotlin\nimplementation(\"io.github.helpermethod:zip-forge:1.0.1\")\n```\n\n# :mag: Usage\n\n## Java\n\nThe following code snippet calls `createZipFile` to create the ZIP file at the given location.\nIt uses the `file` and `directory` methods to create files and directories within the context of the ZIP file.\n\n\u003e [!WARNING]\n\u003e `file` and `directory` should never be used outside of `createZipFile`'s or `directory`'s context.\n\n```java\nimport java.nio.charset.StandardCharsets;\n\nimport static io.github.helpermethod.zipforge.ZipForge.createZipFile;\nimport static io.github.helpermethod.zipforge.ZipForge.file;\nimport static io.github.helpermethod.zipforge.ZipForge.directory;\nimport static java.nio.charset.StandardCharsets.UTF_8;\n\nclass ZipForgeDemo {\n    public static void main(String[] args) throws IOException {\n        // creates a ZIP file named demo.zip in the /home/helpermethod directory\n        createZipFile(Paths.get(\"/home/helpermethod/demo.zip\"), () -\u003e {\n            // the file content can be specified as a String...\n            file(\"a.txt\", \"a\");\n            directory(\"d\", () -\u003e {\n                // ... or a byte[]...\n                file(\"b.txt\", \"b\".getBytes(UTF_8));\n                // ... or a Path\n                file(\"c.bin\", Paths.get(\"c.bin\"));\n                // directories can be nested\n                directory(\"e\", () -\u003e {\n                    file(\"f.txt\", \"f\");\n                });\n            });\n        });\n    }\n}\n```\n\nThe above code results in a ZIP file with the following structure.\n\n```\nArchive:  demo.zip\n  Length      Date    Time    Name\n---------  ---------- -----   ----\n        0  07-11-2023 15:39   d/\n        0  07-11-2023 15:39   d/e/\n        1  07-11-2023 15:39   a.txt\n        1  07-11-2023 15:39   d/b.txt\n        1  07-11-2023 15:39   d/c.bin\n        1  07-11-2023 15:39   d/e/f.txt\n---------                     -------\n        4                     6 files\n```\n\n## Kotlin\n\nThe same example written in Kotlin. It uses the same API as the Java version.\n\n```kotlin\nimport io.github.helpermethod.zipforge.ZipForge.createZipFile\nimport io.github.helpermethod.zipforge.ZipForge.directory\nimport io.github.helpermethod.zipforge.ZipForge.file\nimport kotlin.io.path.Path\n\nfun main() {\n    createZipFile(Path(\"/home/helpermethod/demo.zip\")) {\n        file(\"a.txt\", \"a\")\n        directory(\"d\") {\n            file(\"b.txt\", \"b\".toByteArray())\n            file(\"c.bin\", Path(\"c.bin\"))\n            directory(\"e\") {\n                file(\"f.txt\", \"f\")\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpermethod%2Fzip-forge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpermethod%2Fzip-forge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpermethod%2Fzip-forge/lists"}