Skip to content

Conversation

@jaaaaavier
Copy link
Contributor

### Summary
This PR performs a major update to the file compression system It includes a full cleanup of legacy dependencies and a highly aggressive compression strategy.

Key Changes

  1. Dependency Management
    Removed bloat: Deleted heavy libraries like xlsx, docx, mammoth, and tesseract.js that were not contributing to the compression logic, significantly reducing the final bundle size.

Core Updates: Updated @ffmpeg/ffmpeg to the latest WASM-based version and integrated pdfjs-dist for advanced document processing.

  1. ConverterSection Refactor
    Bug Fix: Resolved the "Element type is invalid" error by refactoring the internal State sub-component into a stable renderState function.

Logic Unification: Merged file validation logic (size and extension checks) into a single reusable function to ensure consistency across drag-and-drop and manual uploads.

Performance: Implemented useMemo for text formatting to prevent unnecessary re-computations during UI interactions.

  1. Enhanced FileCompressorService
    Hybrid PDF Engine: Implemented a dual strategy that attempts structural optimization first, falling back to aggressive page rasterization (DPI scaling + JPEG quality reduction) to force size reduction.

Deep Office Compression: Modern Office files (.docx, .pptx, .xlsx) are now treated as containers. The service extracts internal media assets, compresses them individually, and rebuilds the document.

FFmpeg Integration: Video transcoding is now handled via WebAssembly with an ultrafast preset to optimize processing time within the browser.

Failsafe Logic: Added a size-comparison check that prevents the system from ever returning a file larger than the original upload.

@jaaaaavier jaaaaavier self-assigned this Jan 27, 2026
@jaaaaavier jaaaaavier requested a review from xabg2 as a code owner January 27, 2026 15:07
@jaaaaavier jaaaaavier added the enhancement New feature or request label Jan 27, 2026
@jaaaaavier jaaaaavier marked this pull request as draft January 27, 2026 15:07
@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
website Ready Ready Preview, Comment Jan 28, 2026 11:24am

@jaaaaavier jaaaaavier changed the title update: multi-format client-side compression service [MKT-652]: update/multi-format client-side compression service Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants