{"id":33614404,"url":"https://github.com/cap-go/capacitor-file-compressor","last_synced_at":"2026-04-13T08:02:40.121Z","repository":{"id":325917033,"uuid":"1099436522","full_name":"Cap-go/capacitor-file-compressor","owner":"Cap-go","description":"Capacitor plugin for efficient image compression supporting PNG, JPEG, and WebP formats across iOS, Android, and Web platforms","archived":false,"fork":false,"pushed_at":"2026-01-13T18:57:42.000Z","size":554,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T21:08:24.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cap-go.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"Cap-go","patreon":null,"open_collective":"capgo","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2025-11-19T01:47:48.000Z","updated_at":"2026-01-12T14:07:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Cap-go/capacitor-file-compressor","commit_stats":null,"previous_names":["cap-go/capacitor-file-compressor"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Cap-go/capacitor-file-compressor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-file-compressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-file-compressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-file-compressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-file-compressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap-go","download_url":"https://codeload.github.com/Cap-go/capacitor-file-compressor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap-go%2Fcapacitor-file-compressor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28780014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-12-01T03:06:03.392Z","updated_at":"2026-02-02T09:18:24.056Z","avatar_url":"https://github.com/Cap-go.png","language":"TypeScript","funding_links":["https://github.com/sponsors/Cap-go","https://opencollective.com/capgo"],"categories":[],"sub_categories":[],"readme":"# @capgo/capacitor-file-compressor\n \u003ca href=\"https://capgo.app/\"\u003e\u003cimg src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/?ref=plugin_file-compressor\"\u003e ➡️ Get Instant updates for your App with Capgo\u003c/a\u003e\u003c/h2\u003e\n  \u003ch2\u003e\u003ca href=\"https://capgo.app/consulting/?ref=plugin_file-compressor\"\u003e Missing a feature? We'll build the plugin for you 💪\u003c/a\u003e\u003c/h2\u003e\n\u003c/div\u003e\n\nCapacitor plugin for efficient image compression supporting PNG, JPEG, and WebP formats across iOS, Android, and Web platforms.\n\n## Why File Compressor?\n\nA free, open-source alternative for **client-side image compression**:\n\n- **Multiple formats** - JPEG and WebP compression support\n- **Quality control** - Adjustable compression quality (0.0 - 1.0)\n- **Smart resizing** - Automatic aspect ratio preservation\n- **Cross-platform** - Consistent API across iOS, Android, and Web\n- **Zero backend** - All compression happens on the device\n\nEssential for apps that need to optimize image uploads, reduce storage, or improve performance without server-side processing.\n\n## Documentation\n\nThe most complete doc is available here: https://capgo.app/docs/plugins/file-compressor/\n\n## Compatibility\n\n| Plugin version | Capacitor compatibility | Maintained |\n| -------------- | ----------------------- | ---------- |\n| v8.\\*.\\*       | v8.\\*.\\*                | ✅          |\n| v7.\\*.\\*       | v7.\\*.\\*                | On demand   |\n| v6.\\*.\\*       | v6.\\*.\\*                | ❌          |\n| v5.\\*.\\*       | v5.\\*.\\*                | ❌          |\n\n\u003e **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.\n\n## Install\n\n```bash\nnpm install @capgo/capacitor-file-compressor\nnpx cap sync\n```\n\n## Platform Support\n\n| Platform | Supported Formats | Notes |\n|----------|-------------------|-------|\n| iOS | JPEG | Only JPEG compression supported |\n| Android | JPEG, WebP | Both formats fully supported |\n| Web | JPEG, WebP | Canvas API-based compression |\n\nNote: EXIF metadata is removed during compression on all platforms.\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`compressImage(...)`](#compressimage)\n* [`getPluginVersion()`](#getpluginversion)\n* [Interfaces](#interfaces)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\nCapacitor File Compressor Plugin interface for image compression.\n\n### compressImage(...)\n\n```typescript\ncompressImage(options: CompressImageOptions) =\u003e Promise\u003cCompressImageResult\u003e\n```\n\nCompresses an image file with specified dimensions and quality settings.\n\nThis method compresses images to reduce file size while maintaining acceptable quality.\nIt supports resizing and format conversion (JPEG/WebP depending on platform).\n\n**Important Notes:**\n- EXIF metadata is removed during compression on all platforms\n- Aspect ratio is automatically maintained if only one dimension is provided\n- Compressed files are saved to temporary directories on native platforms\n\n| Param         | Type                                                                  | Description                                   |\n| ------------- | --------------------------------------------------------------------- | --------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#compressimageoptions\"\u003eCompressImageOptions\u003c/a\u003e\u003c/code\u003e | - Configuration options for image compression |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;\u003ca href=\"#compressimageresult\"\u003eCompressImageResult\u003c/a\u003e\u0026gt;\u003c/code\u003e\n\n**Since:** 7.0.0\n\n--------------------\n\n\n### getPluginVersion()\n\n```typescript\ngetPluginVersion() =\u003e Promise\u003c{ version: string; }\u003e\n```\n\nGet the native Capacitor plugin version.\n\nReturns the version of the native plugin implementation.\nUseful for debugging and ensuring compatibility.\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;{ version: string; }\u0026gt;\u003c/code\u003e\n\n**Since:** 7.0.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### CompressImageResult\n\nThe result of compressing an image.\n\nContains either a file path (native platforms) or a Blob (web platform)\ndepending on where the compression was performed.\n\n| Prop       | Type                | Description                                                                                                                                                                                                                                                                                                                                                       | Since |\n| ---------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |\n| **`path`** | \u003ccode\u003estring\u003c/code\u003e | The file path of the compressed image. **Platform:** Android, iOS only (undefined on Web) Points to a temporary file containing the compressed image. On iOS, typically in `NSTemporaryDirectory()`. On Android, typically in app cache directory. **Important:** These files may be cleaned up by the OS. Copy to permanent storage if needed for long-term use. | 7.0.0 |\n| **`blob`** | \u003ccode\u003eBlob\u003c/code\u003e   | The blob of the compressed image. **Platform:** Web only (undefined on iOS/Android) A Blob object containing the compressed image data. Can be used to: - Create object URLs for preview: `URL.createObjectURL(blob)` - Upload to server via FormData - Save to IndexedDB or other storage - Convert to base64 with FileReader                                    | 7.0.0 |\n\n\n#### CompressImageOptions\n\nOptions for compressing an image.\n\nConfigure the compression behavior including quality, dimensions, and output format.\nPlatform-specific options are available for path (native) and blob (web).\n\n| Prop           | Type                | Description                                                                                                                                                                                                                                                                                                                                                                                             | Default                   | Since |\n| -------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ----- |\n| **`path`**     | \u003ccode\u003estring\u003c/code\u003e | The file path of the image to compress. **Platform:** Android, iOS only (not supported on Web) Accepts various path formats: - iOS: `file://` URLs or absolute paths - Android: `content://` URIs, `file://` URLs, or absolute paths                                                                                                                                                                    |                           | 7.0.0 |\n| **`blob`**     | \u003ccode\u003eBlob\u003c/code\u003e   | The file blob of the image to compress. **Platform:** Web only (not supported on iOS/Android) Use this when compressing images from file inputs, fetch responses, or any other Blob source in web applications.                                                                                                                                                                                         |                           | 7.0.0 |\n| **`quality`**  | \u003ccode\u003enumber\u003c/code\u003e | The quality of the compressed image. **Range:** 0.0 to 1.0 - `0.0` = Maximum compression (lowest quality, smallest file) - `1.0` = Minimum compression (highest quality, largest file) - `0.6` = Default balanced compression **Platform:** All platforms Higher quality values result in larger files but better visual quality. The actual compression ratio depends on the image content and format. | \u003ccode\u003e0.6\u003c/code\u003e          | 7.0.0 |\n| **`width`**    | \u003ccode\u003enumber\u003c/code\u003e | The width of the compressed image in pixels. **Platform:** All platforms If only width is specified, height is calculated automatically to maintain the original aspect ratio. If both width and height are specified, the image is resized to exact dimensions (may distort if ratio differs).                                                                                                         |                           | 7.0.0 |\n| **`height`**   | \u003ccode\u003enumber\u003c/code\u003e | The height of the compressed image in pixels. **Platform:** All platforms If only height is specified, width is calculated automatically to maintain the original aspect ratio. If both width and height are specified, the image is resized to exact dimensions (may distort if ratio differs).                                                                                                        |                           | 7.0.0 |\n| **`mimeType`** | \u003ccode\u003estring\u003c/code\u003e | The MIME type of the compressed output image. **Platform Support:** - **iOS:** `image/jpeg` only - **Android:** `image/jpeg`, `image/webp` - **Web:** `image/jpeg`, `image/webp` **Format Characteristics:** - **JPEG:** Universal support, good for photos, no transparency - **WebP:** Better compression, supports transparency, not on iOS                                                          | \u003ccode\u003e\"image/jpeg\"\u003c/code\u003e | 7.0.0 |\n\n\u003c/docgen-api\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcapacitor-file-compressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcap-go%2Fcapacitor-file-compressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap-go%2Fcapacitor-file-compressor/lists"}