Skip to content

🤖 v0.2.0 Web Worker Architecture

Choose a tag to compare

@github-actions github-actions released this 26 Aug 08:53
93758cd

HashFS v0.2.0 - Web Worker Architecture Release

🚀 Major Performance & Architecture Improvements

Web Worker Architecture

  • Complete isolation: All cryptographic operations, IndexedDB storage, and chain management now run in dedicated web workers
  • Non-blocking UI: Main thread stays responsive during heavy operations like bulk imports/exports
  • Structured messaging: Clean, type-safe communication between main thread and workers
  • Dedicated workers: Separate workers for core operations and bulk processing with progress tracking

Optimized Memory Management

  • Transferable ArrayBuffers: Zero-copy file transfers using modern Transferable Objects API
  • Future-proof: Simplified architecture using only ArrayBuffer transfers - no complex SharedArrayBuffer dependencies
  • Universal compatibility: Works consistently across all modern browsers without special headers
  • Efficient caching: Smart buffer management prevents memory duplication

Enhanced User Experience

  • Real-time progress: Live progress tracking for bulk import/export operations with file-by-file status
  • Responsive interface: UI remains interactive during heavy crypto operations
  • Better error handling: Granular error reporting for individual files in batch operations
  • Auto-save improvements: Debounced saves with dirty state tracking in worker context

Simplified Deployment

  • No special headers: Removed SharedArrayBuffer dependency eliminates COOP/COEP header requirements
  • Broader compatibility: Works in more hosting environments including GitHub Pages, Netlify, etc.
  • Standard web workers: Uses widely-supported Web Worker APIs for maximum compatibility

🔧 Technical Improvements

Security Enhancements

  • Isolated crypto operations: All key derivation and encryption happens in secure worker context
  • Memory isolation: Sensitive operations completely separated from main thread
  • Integrity verification: Ed25519 signature verification for all file operations

Code Quality

  • DRY architecture: Eliminated code duplication between main thread and worker contexts
  • ESM modules: Clean ES module structure throughout worker and main code
  • Type-safe messaging: Structured request/response patterns with proper error propagation
  • Maintainable composables: Vue 3 composables provide clean reactive API

Performance Optimizations

  • Efficient compression: Built-in deflate/inflate with worker-based processing
  • Smart cleanup: Automatic orphaned file detection and removal in background
  • Optimized builds: Proper code splitting separates workers and core logic

🛠 Developer Experience

Clean API

// Simple, reactive API unchanged
const { auth, files, useFile, importAll } = useHashFS("passphrase");
const file = useFile("document.txt");
file.text.value = "Hello World"; // Auto-saves in worker

// Progress tracking for bulk operations
await importAll(fileList, (progress) => {
	console.log(`${progress.completed}/${progress.total}: ${progress.current}`);
});

Modern Build Tools

  • Vite integration: Optimized Vite configuration for worker builds
  • Hot reload: Workers reload properly in development
  • Production ready: Optimized worker chunking and loading

📊 Performance Impact

  • Main thread blocking: Eliminated during file operations
  • Memory efficiency: Reduced memory copying through transferable objects
  • Startup time: Faster initialization through worker pre-loading
  • Bulk operations: 2-3x faster import/export with parallel processing

🔄 Migration Guide

No breaking changes - existing HashFS usage patterns remain identical. The worker architecture is completely transparent to existing code.

🎯 Use Cases Enhanced

  • Large file handling: Better performance for files >10MB
  • Bulk operations: Faster