evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a progress monitoring system that tracks and reports the parsing progress of a streaming JSON response. The system should provide real-time insights into how much data has been received and parsed at various checkpoints during the streaming process.
Your implementation should:
The system should capture progress snapshots that include:
/**
* Creates a progress monitor for streaming JSON parsing.
*
* @param {Stream} stream - A readable stream containing JSON data
* @param {Function} progressCallback - Called periodically with progress info:
* {
* timestamp: number, // Unix timestamp in milliseconds
* currentData: object|array, // Current state of parsed JSON tree
* topLevelCount: number, // Number of top-level properties/items parsed
* isComplete: boolean // Whether parsing is finished
* }
* @param {number} intervalMs - Milliseconds between progress checks (default: 100)
* @returns {Promise<object>} Resolves with the complete parsed JSON
*/
function monitorProgress(stream, progressCallback, intervalMs) {
// IMPLEMENTATION HERE
}
module.exports = { monitorProgress };{"a": 1}, progress callback receives at least one update with partial data @test[1, 2, 3], progress callback receives updates showing increasing topLevelCount @testProvides streaming JSON parsing with progressive access to partial results.