Module data_loader

Module data_loader 

Source
Expand description

Data loader module for discovering and parsing JSONL files

This module handles platform-specific discovery of Claude usage data files and provides streaming access to parse large JSONL files efficiently.

§Platform Support

The data loader automatically discovers Claude data directories on:

  • macOS: ~/Library/Application Support/Claude
  • Linux: ~/.config/Claude or $XDG_CONFIG_HOME/Claude
  • Windows: %APPDATA%\Claude

You can override the search path using the CLAUDE_DATA_PATH environment variable.

§Examples

use ccstat::data_loader::DataLoader;
use futures::StreamExt;

let data_loader = DataLoader::new().await?;

// Stream usage entries
let entries = data_loader.load_usage_entries_parallel();
tokio::pin!(entries);
while let Some(result) = entries.next().await {
    let entry = result?;
    println!("Session: {}, Tokens: {}", entry.session_id, entry.tokens.total());
}

Structs§

DataLoader
Data loader for discovering and streaming JSONL files