patorjk / figlet.js

A FIG Driver written in JavaScript which aims to fully implement the FIGfont spec.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use figlet on typescript?

MarcosCostaDev opened this issue · comments

I'm not that familiar with TypeScript. This is just a regular JavaScirpt library though, so you'd integrate it into your setup the same way you'd integrate any other JavaScript library.

@marcoslcosta This is how i used figlet into typescript class. Here there is class to print input data with testFiglet method

import * as figlet from 'figlet';

class FigletTest() {

    testFiglet(testData: string) => {
        figlet(testData, (error: any, data: any) => {
            if (error) {
                return process.exit(1);
            }
            console.log(chalk.blue(data));
            console.log('');
            process.exit(0);
        });
    }
}

@sridharmallela Thank you, I'm going to test this way soon.