Loads the complete statistics data structure from the application's user data directory,
performing data validation and repair operations to ensure integrity. If no statistics
file exists, it creates a new one with default values.
The function performs several important operations:
Ensures the data directory exists before attempting to read
Creates default statistics if no file is found
Converts serialized arrays back to Set objects for uniqueness tracking
Repairs any missing or corrupted data fields
Preserves backward compatibility with older data formats
Throws
Error if file operations fail or data cannot be processed
Example
// Get statistics for dashboard display try { conststats = awaitgetStatistics(); displaySkipRate(stats.overallSkipRate); renderTimeChart(stats.hourlyDistribution); } catch (error) { showErrorMessage("Failed to load statistics"); }
Retrieves statistics data from persistent storage
Loads the complete statistics data structure from the application's user data directory, performing data validation and repair operations to ensure integrity. If no statistics file exists, it creates a new one with default values.
The function performs several important operations:
Throws
Error if file operations fail or data cannot be processed
Example
Source