docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a utility that analyzes the character encodings of multiple text files concurrently and generates a summary report.
Create a module that processes a list of file paths and determines their character encodings. The module should:
For performance reasons, when analyzing large files (over 100KB), only sample the first 32KB of data.
/**
* Analyzes the character encodings of multiple files concurrently.
*
* @param {string[]} filePaths - Array of file paths to analyze
* @returns {Promise<AnalysisResult>} Analysis results
*/
async function analyzeEncodings(filePaths) {
// IMPLEMENTATION HERE
}
/**
* @typedef {Object} AnalysisResult
* @property {Object.<string, string|null>} encodings - Map of file paths to detected encodings
* @property {Object.<string, number>} summary - Count of files by encoding type
* @property {string[]} failed - List of file paths that could not be analyzed
*/
module.exports = {
analyzeEncodings
};Provides character encoding detection functionality.