{"id":15471753,"url":"https://github.com/itznotabug/documentfilecompat","last_synced_at":"2025-04-22T13:20:56.059Z","repository":{"id":57726083,"uuid":"434911844","full_name":"ItzNotABug/DocumentFileCompat","owner":"ItzNotABug","description":"A blazing fast alternative to AndroidX's DocumentFile.","archived":false,"fork":false,"pushed_at":"2023-10-14T08:25:43.000Z","size":256,"stargazers_count":60,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T01:16:03.004Z","etag":null,"topics":["android-documentfile","android-library","android-saf","androidx-documentfile","androidx-library"],"latest_commit_sha":null,"homepage":"","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/ItzNotABug.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-12-04T13:41:11.000Z","updated_at":"2024-07-29T01:32:55.000Z","dependencies_parsed_at":"2024-11-02T02:32:01.238Z","dependency_job_id":null,"html_url":"https://github.com/ItzNotABug/DocumentFileCompat","commit_stats":{"total_commits":78,"total_committers":1,"mean_commits":78.0,"dds":0.0,"last_synced_commit":"69e83caf5705f94413ad0eb1e13e6e242d9f1f67"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FDocumentFileCompat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FDocumentFileCompat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FDocumentFileCompat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FDocumentFileCompat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItzNotABug","download_url":"https://codeload.github.com/ItzNotABug/DocumentFileCompat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250246746,"owners_count":21398919,"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":["android-documentfile","android-library","android-saf","androidx-documentfile","androidx-library"],"created_at":"2024-10-02T02:21:37.678Z","updated_at":"2025-04-22T13:20:56.038Z","avatar_url":"https://github.com/ItzNotABug.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DocumentFileCompat\n\nA faster alternative to AndroidX's DocumentFile.\n\n### The Problem with DocumentFile\n\nIt is horribly slow!\\\nFor **almost** every method, there is a query to **ContentResolver**.\n\nThe most common one is `DocumentFile.findFile()`, `DocumentFile.getName()` and other is building a\nCustom Data Model with multiple parameters.\\\nThis can take like a horrible amount of time.\n\n### Solution\n\n`DocumentFileCompat` is a drop-in replacement which gathers relevant parameters when querying for\nfiles.\\\nThe performance can sometimes peak to 2x or quite higher, depending on the size of the folder.\n\nCheck the screenshots below:\n\n[\u003cimg src=\"/screenshots/filecompat_directory_perf.jpeg\" height=\"500\"/\u003e](/screenshots/filecompat_directory_perf.jpeg)\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n[\u003cimg src=\"/screenshots/filecompat_file_perf.jpeg\" height=\"500\"/\u003e](/screenshots/filecompat_file_perf.jpeg)\n\n**48 whopping seconds for directory listing compared to 3.5!** (Obviously, No competition with the\nNative File API).\\\nAlso extracting file information does not take that much time but the improvement is still\nsignificant.\n\n**Note:** `DocumentFileCompat` is something that I used internally for some projects \u0026 therefore I\ndidn't do much of file manipulation with it (only delete files) \u003cstrike\u003eand therefore this API does\nnot offer too much out of the box\u003c/strike\u003e.\\\nThis is now a completely usable alternative to `DocumentFile`.\n\n### Installation\n\n#### Gradle\n\n```gradle\ndependencies {\n    implementation \"com.lazygeniouz:dfc:$latest_version\"\n}\n```\n\n#### Maven\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.lazygeniouz\u003c/groupId\u003e\n    \u003cartifactId\u003edfc\u003c/artifactId\u003e\n    \u003cversion\u003e$latest_version\u003c/version\u003e\n    \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n### Usage\n\nAlmost all of the methods \u0026 getters are identical to `DocumentFile`, you'll just have to replace the\nimports.\\\nAdditional methods like `copyTo(destination: Uri)` \u0026 `copyFrom(source: Uri)` are added as well.\n\n#### Reference:\n\n1. https://stackoverflow.com/a/42187419/6819340\n2. https://stackoverflow.com/a/63466997/6819340\n\n### Issues \u0026 Suggestions\n\nCreate a new issue if you experience any problem or have any suggestions.\\\nI'll appreciate if you create a PR as well (if possible).\n\nFinally, don't forget to ⭐️ the library! :)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitznotabug%2Fdocumentfilecompat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitznotabug%2Fdocumentfilecompat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitznotabug%2Fdocumentfilecompat/lists"}