packfs-core
Version:
Semantic filesystem operations for LLM agent frameworks with natural language understanding. See LLM_AGENT_GUIDE.md for copy-paste examples.
21 lines • 708 B
JavaScript
/**
* Text content processor
*/
export class TextProcessor {
constructor() {
this.textExtensions = [
'txt', 'md', 'json', 'yaml', 'yml', 'xml', 'csv',
'js', 'ts', 'py', 'java', 'cpp', 'c', 'h', 'css', 'html'
];
}
async process(content, _filename) {
const text = typeof content === 'string' ? content : content.toString('utf-8');
// Basic text processing - normalize line endings and trim
return text.replace(/\r\n/g, '\n').trim();
}
canProcess(filename) {
const ext = filename.split('.').pop()?.toLowerCase();
return ext ? this.textExtensions.includes(ext) : false;
}
}
//# sourceMappingURL=text.js.map