docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a tool that analyzes text files from a directory and reports the character encoding of each file. The tool must use synchronous operations to process files.
The tool accepts a directory path as input and scans all .txt files in that directory. For each file, it determines the character encoding synchronously and returns the results.
Output format:
.txt files ("sample1.txt", "sample2.txt", "sample3.txt"), returns results for all three files @test/**
* Analyzes all .txt files in a directory and returns encoding information
*
* @param directoryPath - Path to the directory to analyze
* @returns Array of file analysis results
*/
export interface FileAnalysisResult {
filename: string;
encoding: string;
status: 'pass' | 'fail';
}
export function analyzeDirectory(directoryPath: string): FileAnalysisResult[];Provides character encoding detection support.