send or print newsletter preview

This commit is contained in:
Julian Krauser 2024-12-28 18:03:33 +01:00
parent 5a59a63e4a
commit 5f827fb177
15 changed files with 355 additions and 28 deletions

View file

@ -24,6 +24,9 @@ export abstract class FileSystemHelper {
static getFilesInDirectory(directoryPath: string, filetype?: string): string[] {
const fullPath = join(process.cwd(), directoryPath);
if (!existsSync(fullPath)) {
return [];
}
return readdirSync(fullPath, { withFileTypes: true })
.filter((dirent) => !dirent.isDirectory() && (!filetype || dirent.name.endsWith(filetype)))
.map((dirent) => dirent.name);