A powerful, client-side file compression tool that reduces file sizes using advanced algorithms and multi-threaded processing. Supports PDF, images, documents, and archives with multiple compression methods - all processed securely in your browser.
- Multi-threaded Processing - Uses Web Workers for parallel compression of multiple files
- Advanced Algorithms - Implements Brotli, gzip, and optimized image encoding
- Smart Compression - Automatically selects the best compression method for each file type
- Custom Target Size - Set specific target file sizes for precise compression control
- PDF Files - Advanced PDF compression with image optimization
- Images - JPEG, PNG, WebP, BMP compression with quality control
- Documents - Text, HTML, CSS, JavaScript, JSON, XML compression
- Archives - ZIP file optimization (coming soon)
- Quality Mode - High quality, moderate compression (85% quality, 90% scale)
- Balanced Mode - Best balance of size and quality (60% quality, 70% scale)
- Maximum Mode - Maximum compression, lower quality (30% quality, 50% scale)
- Custom Mode - Set your own target file size
- 100% Client-Side - Your files never leave your device for maximum privacy
- Drag & Drop Interface - Intuitive file selection with drag and drop support
- Batch Processing - Compress multiple files at once with parallel processing
- Real-time Progress - Visual progress indicators with detailed statistics
- Responsive Design - Works perfectly on desktop, tablet, and mobile devices
- Detailed Analytics - Compression ratio, processing speed, and size savings
- HTML5 - Modern semantic markup with Web Workers support
- CSS3 - Advanced styling with animations and responsive design
- JavaScript (ES6+) - Modern JavaScript with classes, async/await, and Web Workers
- PDF-lib (v1.17.1) - Advanced PDF manipulation and compression
- PDF.js (v3.11.174) - PDF rendering and page extraction
- Pako (v2.1.0) - High-performance gzip/deflate compression for text files
- JSZip - ZIP file creation for batch downloads (optional)
- Font Awesome (v6.4.0) - Modern icons
- Google Fonts (Inter) - Clean, professional typography
| Category | Formats | Compression Method |
|---|---|---|
.pdf |
Image optimization, page rendering, object streams | |
| Images | .jpg, .jpeg, .png, .webp, .bmp |
Quality reduction, scaling, format conversion |
| Documents | .txt, .html, .css, .js, .json, .xml |
gzip compression with multiple levels |
| Archives | .zip |
Optimization (planned) |
- PDF.js Rendering - Renders PDF pages to canvas with scaling
- Image Optimization - Converts pages to JPEG with adjustable quality
- Object Streams - Uses PDF object streams for better compression
- Metadata Removal - Strips unnecessary metadata
- Canvas Scaling - Reduces image dimensions while maintaining aspect ratio
- Quality Control - Adjustable JPEG/WebP quality settings
- Format Conversion - Converts to more efficient formats (PNG β JPEG)
- Gzip Compression - Industry-standard gzip with levels 1-9
- Streaming - Efficient processing for large text files
| Browser | Minimum Version | Web Workers | OffscreenCanvas |
|---|---|---|---|
| Chrome | 60+ | β Yes | β Yes |
| Firefox | 55+ | β Yes | β Yes |
| Safari | 12+ | β Yes | |
| Edge | 79+ | β Yes | β Yes |
-
Clone the repository
git clone https://github.com/Tranquil666/FILE_COMPRESSOR.git cd FILE_COMPRESSOR -
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open in browser
http://localhost:3000
-
Build for production
npm run production
-
Deploy to your hosting service
- The application is fully static and can be deployed to any web server
- Recommended: Vercel, Netlify, GitHub Pages, or Render
- PDF Files: 40-70% size reduction (typical)
- JPEG Images: 30-60% size reduction
- PNG Images: 50-80% size reduction
- Text Files: 60-90% size reduction
- Single-threaded: ~2-5 MB/s
- Multi-threaded: ~8-20 MB/s (depends on CPU cores)
- Web Workers: Up to 4x faster on modern multi-core CPUs
- Clean, minimalist interface with gradient backgrounds
- Smooth animations and transitions
- Card-based layout for better organization
- Color-coded compression levels
- Clear visual feedback for all actions
- Progress indicators with file names
- Detailed compression statistics (ratio, speed, savings)
- Error handling with helpful messages
- Responsive design for all screen sizes
- Semantic HTML structure
- ARIA labels for screen readers
- Keyboard navigation support
- High contrast text
- Focus indicators
- 100% Client-Side Processing - Files never uploaded to any server
- No Data Collection - Zero tracking or analytics
- Secure by Design - Uses Content Security Policy (CSP)
- HTTPS Recommended - Secure connections for script loading
- Rate Limiting - Protection against abuse (100 requests per 15 minutes)
FILE_COMPRESSOR/
βββ index.html # Main HTML file with UI structure
βββ script-enhanced.js # Main application logic with multi-format support
βββ compression-worker.js # Web Worker for parallel compression
βββ script.js # Legacy script (deprecated)
βββ styles.css # Complete styling and animations
βββ server.js # Express server with security middleware
βββ package.json # Dependencies and scripts
βββ README.md # Documentation
- Main Thread - UI interactions, file management, result display
- Worker Threads - Heavy compression tasks, PDF processing, image encoding
- Message Passing - Efficient communication between main thread and workers
- ArrayBuffer Transfer - Zero-copy data transfer for performance
Edit presets in script-enhanced.js:
compressionPresets: {
maximum: { level: 'high', quality: 0.3, scale: 0.5 },
balanced: { level: 'medium', quality: 0.6, scale: 0.7 },
quality: { level: 'low', quality: 0.85, scale: 0.9 },
custom: { level: 'custom', quality: 0.7, scale: 0.8 }
}Environment variables in .env:
PORT=3000
NODE_ENV=production
FRONTEND_URL=https://your-domain.comDefault: 100MB per file. Modify in script-enhanced.js:
const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MBContributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow ES6+ JavaScript standards
- Maintain browser compatibility
- Write clean, documented code
- Test on multiple browsers
- Optimize for performance
- β¨ Added multi-format support (PDF, images, documents)
- β¨ Implemented Web Workers for parallel processing
- β¨ Added advanced compression algorithms (Brotli, gzip)
- β¨ Enhanced compression presets (Quality, Balanced, Maximum)
- β¨ Added detailed compression analytics
- β¨ Improved PDF compression with image optimization
- π Fixed compression ratio calculations
- π Improved error handling
- π Updated UI for multi-format support
- π Enhanced documentation
- Initial release with PDF compression
- Basic compression levels
- Drag and drop interface
- Batch processing
- Safari: Limited OffscreenCanvas support (falls back to regular Canvas)
- Large files (>50MB): May cause memory issues on low-end devices
- Custom target size: May not be achievable for all file types
- Add support for more image formats (TIFF, SVG)
- Implement ZIP file optimization
- Add real-time compression preview
- Support for video compression
- Progressive Web App (PWA) support
- Compression quality comparison tool
- Cloud save feature (optional)
- Command-line interface (CLI)
MIT License - see LICENSE file for details
Faisal
- Built with β€οΈ for better file management
- PDF-lib - Excellent PDF manipulation library
- PDF.js - Mozilla's PDF rendering library
- Pako - Fast zlib port to JavaScript
- Font Awesome - Icon library
- Google Fonts - Inter font family
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation
- Review closed issues for solutions
- Live Demo (if deployed)
- GitHub Repository
- Report Issues
Star β this repository if you find it helpful!
Built with modern web technologies for fast, secure, and efficient file compression.