Skip to content

v4.37.0

Latest

Choose a tag to compare

@iuccio iuccio released this 19 Apr 15:28
· 52 commits to master since this release

Release Notes - v4.37.

🚀 New Features

Enhanced Streaming Parsing for Large Files

Memory-Efficient File Processing

  • Added getJsonFromFileStreamingAsync(file) method for processing large CSV files without loading them entirely into memory
  • Automatic fallback to regular parsing for older browsers that don't support native streaming
  • Optimized for files larger than 1MB to prevent memory issues

Progress Callbacks for Real-Time Feedback

  • New getJsonFromFileStreamingAsyncWithCallback(file, options) method with progress tracking
  • onChunk callback provides real-time updates during processing: (rows, processed, total) => {}
  • onComplete callback fires when processing finishes: (allRows) => {}
  • onError callback for error handling: (error) => {}
  • Configurable chunkSize option (default: 1000 rows per chunk)

Improved Browser Demo Experience

Visual Progress Indicators

  • Real-time progress bar for large file processing
  • Animated loading spinner with "Processing large file" message
  • Progress updates during chunked processing operations
  • Automatic progress bar removal after completion

Enhanced User Interface

  • Refactored demo code with modular architecture (UIManager, ConfigManager, FileProcessor, etc.)
  • Better error handling and user feedback
  • Improved responsive design and accessibility
  • Automatic streaming options for files > 1MB

📋 API Changes

New Methods

// Basic streaming (memory-efficient)
const data = await csvToJson.browser.getJsonFromFileStreamingAsync(file);

// Streaming with progress callbacks
await csvToJson.browser.getJsonFromFileStreamingAsyncWithCallback(file, {
  chunkSize: 1000,
  onChunk: (rows, processed, total) => {
    console.log(`Processed ${processed}/${total} rows`);
    // Update progress bar here
  },
  onComplete: (allRows) => {
    console.log('Processing complete!');
  },
  onError: (error) => {
    console.error('Error:', error);
  }
});

🔧 Technical Improvements

  • StreamProcessor class enhancements for better browser compatibility
  • Error handling improvements with specific error types
  • Memory management optimizations for large file processing
  • Browser API validation and input sanitization

🐛 Bug Fixes

  • Fixed progress bar display issues in demo
  • Improved error messages for invalid file inputs
  • Better handling of edge cases in streaming operations

📚 Documentation Updates

  • Updated README.md with streaming API examples
  • Added comprehensive JSDoc comments for new methods
  • Enhanced browser usage documentation
  • Updated demo with progress tracking examples

🔄 Migration Guide

For existing users:

  • No breaking changes to existing APIs
  • New streaming methods are additive features
  • Demo automatically uses streaming for large files

For upgrading:

npm update convert-csv-to-json

🎯 Performance Benefits

  • Memory Usage: Up to 90% reduction for large files (>1MB)
  • Processing Speed: Faster parsing with chunked processing
  • User Experience: Real-time feedback prevents UI freezing
  • Scalability: Handle files of any size without memory constraints