mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 10:21:06 +05:30
feat(renderer): AsciiGeneratorDialog (figlet text-to-ASCII-art)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import figlet from 'figlet';
|
||||
import type { Fonts } from 'figlet';
|
||||
|
||||
export const FIGLET_FONTS = ['Standard', 'Big', 'Small', 'Banner', 'Doom', 'Slant', 'Block'] as const;
|
||||
export type FigletFont = typeof FIGLET_FONTS[number];
|
||||
|
||||
export function figletText(text: string, font: FigletFont): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
figlet.text(text, { font }, (err, result) => {
|
||||
if (err) reject(err);
|
||||
else resolve(result ?? '');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user