Initial commit

This commit is contained in:
Igor Martyniuk
2026-06-25 15:53:49 +03:00
commit 1bb0b7e68a
1517 changed files with 218469 additions and 0 deletions
@@ -0,0 +1,22 @@
import { FileEntry } from '#base_modules/FileManager/types/entries'
const PREVIEWABLE_TEXT_EXTENSIONS = ['txt', 'md', 'log', 'json', 'csv']
export default class FilePreviewService {
public async withPreview(
entry: FileEntry,
getContent: () => Promise<string>
): Promise<FileEntry & { content?: string }> {
if (!this.isPreviewableTextFile(entry.name)) return entry
const content = await getContent()
return { ...entry, content }
}
private isPreviewableTextFile(name: string): boolean {
const fileExt = name.split('.').pop()?.toLowerCase()
return PREVIEWABLE_TEXT_EXTENSIONS.includes(fileExt as string)
}
}