{"id":22282048,"url":"https://github.com/junrar/junrar","last_synced_at":"2025-05-14T04:08:46.475Z","repository":{"id":4532393,"uuid":"5672635","full_name":"junrar/junrar","owner":"junrar","description":"Plain Java unrar library","archived":false,"fork":false,"pushed_at":"2025-05-12T03:34:02.000Z","size":13825,"stargazers_count":295,"open_issues_count":1,"forks_count":77,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-12T03:41:48.899Z","etag":null,"topics":["archive","compression","rar","uncompress"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/junrar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2012-09-04T13:14:45.000Z","updated_at":"2025-05-12T03:34:05.000Z","dependencies_parsed_at":"2023-07-06T12:32:12.552Z","dependency_job_id":"d0e7765e-6f7f-4ece-b920-986eb92117ef","html_url":"https://github.com/junrar/junrar","commit_stats":{"total_commits":387,"total_committers":28,"mean_commits":"13.821428571428571","dds":0.6537467700258398,"last_synced_commit":"9ea7d0f7abd9a0d8e1b2a02ebf139b2469167933"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junrar%2Fjunrar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junrar%2Fjunrar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junrar%2Fjunrar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junrar%2Fjunrar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junrar","download_url":"https://codeload.github.com/junrar/junrar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069908,"owners_count":22009558,"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":["archive","compression","rar","uncompress"],"created_at":"2024-12-03T16:24:52.179Z","updated_at":"2025-05-14T04:08:41.446Z","avatar_url":"https://github.com/junrar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/junrar/junrar/actions/workflows/ci.yml/badge.svg)](https://github.com/junrar/junrar/actions/workflows/ci.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.junrar/junrar)](https://search.maven.org/artifact/com.github.junrar/junrar)\n[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.github.junrar/junrar?color=blue\u0026label=maven%20snapshot\u0026server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/com/github/junrar/junrar/)\n[![javadoc](https://javadoc.io/badge2/com.github.junrar/junrar/javadoc.svg)](https://javadoc.io/doc/com.github.junrar/junrar)\n[![codecov](https://codecov.io/gh/junrar/junrar/branch/master/graph/badge.svg)](https://codecov.io/gh/junrar/junrar)\n\n# Junrar\n\nRead and extracts from a .rar file. This is a fork of the junrar codebase, formerly on sourceforge.\n\nCode may not be used to develop a RAR (WinRAR) compatible archiver.\n\n## Supported features\n\n- RAR 4 and lower (there is no RAR 5 support)\n- password protected archives (also with encrypted headers)\n- multi-part archives\n- extract from `File` and `InputStream`\n- extract to `File` and `OutputStream`\n\n## Installation\n\n### Gradle\n\n```groovy\nimplementation \"com.github.junrar:junrar:{version}\"\n```\n\n### Gradle (Kotlin DSL)\n\n```kotlin\nimplementation(\"com.github.junrar:junrar:{version}\")\n```\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.junrar\u003c/groupId\u003e\n  \u003cartifactId\u003ejunrar\u003c/artifactId\u003e\n  \u003cversion\u003e{version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nwhere `{version}` corresponds to version as below:\n\n- Java 8 Version: [![Maven Central](https://img.shields.io/maven-central/v/com.github.junrar/junrar)](https://search.maven.org/artifact/com.github.junrar/junrar)\n- Java 6 Compatible Version: [![Maven Central](https://img.shields.io/maven-central/v/com.github.junrar/junrar?versionPrefix=4.0.0)](https://search.maven.org/artifact/com.github.junrar/junrar/4.0.0/jar)\n\nApache Commons VFS support has been removed from `5.0.0`, and moved to a dedicated repo: https://github.com/junrar/commons-vfs-rar\n\n## Usage\n\n### Extract from a file to a directory:\n```java\nJunrar.extract(\"/tmp/foo.rar\", \"/tmp\");\n//or\nfinal File rar = new File(\"foo.rar\");  \nfinal File destinationFolder = new File(\"destinationFolder\");\nJunrar.extract(rar, destinationFolder);    \n//or\nfinal InputStream resourceAsStream = Foo.class.getResourceAsStream(\"foo.rar\");//only for a single rar file\nJunrar.extract(resourceAsStream, tempFolder);\n```\n\n### Extract from an InputStream to an OutputStream \n```java\n// Assuming you already have an InputStream from the rar file and an OutputStream for writing to\nfinal Archive archive = new Archive(inputStream);\nwhile (true) {\n  FileHeader fileHeader = archive.nextFileHeader();\n  if (fileHeader == null) {\n      break;\n  }\n  archive.extractFile(fileHeader, outputStream); \n}\n```\n\n### Extract from an InputStream to an InputStream\n```java\n// Assuming you already have an InputStream from the rar file and an OutputStream for writing to\nfinal Archive archive = new Archive(inputStream);\nwhile (true) {\n  FileHeader fileHeader = archive.nextFileHeader();\n  if (fileHeader == null) {\n      break;\n  }\n  try (InputStream is = archive.getInputStream(fileHeader)) {\n      // Then use the InputStream for any method that uses that as an input, ex.:\n      Files.copy(is, Paths.get(\"destinationFile.txt\"));\n  }\n}\n```\n\n### List files\n```java\nfinal List\u003cContentDescription\u003e contentDescriptions = Junrar.getContentsDescription(testDocuments);    \n```\n\n### Extract a password protected archive\n```java\nJunrar.extract(\"/tmp/foo.rar\", \"/tmp\", \"password\");\n//or\nfinal File rar = new File(\"foo.rar\");  \nfinal File destinationFolder = new File(\"destinationFolder\");\nJunrar.extract(rar, destinationFolder, \"password\");    \n//or\nfinal InputStream resourceAsStream = Foo.class.getResourceAsStream(\"foo.rar\");//only for a single rar file\nJunrar.extract(resourceAsStream, tempFolder, \"password\");\n```\n\n### Extract a multi-volume archive\n```java\nJunrar.extract(\"/tmp/foo.001.rar\", \"/tmp\");\n```\n\n## Configuration\n\nJunrar allows for some tuning using System Properties:\n\n- Options for `Archive#getInputStream(FileHeader)`:\n  - `junrar.extractor.buffer-size`: accepts any positive integer. Defaults to `32 * 1024`. \n    - Sets the maximum size used for the dynamic byte buffer in the `PipedInputStream`.\n  - `junrar.extractor.use-executor`: accepts either `true` or `false`. Defaults to `true`.\n    - If `true`, it uses a cached thread pool for extracting the contents, which is generally faster.\n    - If `false`, it will create a new thread on each call. This may be slower, but may require slightly less memory.\n    - Options for tuning the thread pool:\n      - `junrar.extractor.max-threads`: accepts any positive integer. Defaults to `2^31`.\n        - Sets the maximum number of threads to be used in the pool. By default, there is no hard limit on the number \n          of threads, but they are only created when needed, so the maximum should not exceed the number of threads \n          calling this method at any given moment. Use this if you need to restrict the number of threads.\n      - `junrar.extractor.thread-keep-alive-seconds`: accepts any positive integer. Defaults to `5`. \n        - Sets the number of seconds a thread can be kept alive in the pool, waiting for a next extraction operation. \n          After that time, the thread may be stopped.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunrar%2Fjunrar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunrar%2Fjunrar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunrar%2Fjunrar/lists"}