npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

figlet-go

v0.1.2

Published

FIGlet ASCII art text generator - WebAssembly module compiled from Go

Downloads

12

Readme

figlet-go

FIGlet ASCII art text generator - WebAssembly module compiled from Go

npm version License: BSD-3-Clause

Generate beautiful ASCII art text from your JavaScript/Node.js applications using the power of WebAssembly.

Installation

npm install figlet-go

Quick Start

const figlet = require('figlet-go');

// Simple rendering
const art = await figlet.render('Hello!');
console.log(art);

// Output:
//  _   _      _ _       _ 
// | | | | ___| | | ___ | |
// | |_| |/ _ \ | |/ _ \| |
// |  _  |  __/ | | (_) |_|
// |_| |_|\___|_|_|\___/(_)

API Reference

render(text: string): Promise<string>

Render text using the default font (standard).

const art = await figlet.render('Hello');

renderWithFont(text: string, font: string): Promise<string>

Render text with a specific font.

const art = await figlet.renderWithFont('Hello', 'slant');

listFonts(): Promise<string[]>

Get a list of all available fonts.

const fonts = await figlet.listFonts();
console.log(fonts); // ['banner', 'big', 'block', ...]

getVersion(): Promise<string>

Get the FIGlet version.

const version = await figlet.getVersion();
console.log(version); // '2.2.5'

createInstance(options?): Promise<FigletInstance>

Create a configured FIGlet instance for more control.

const fig = await figlet.createInstance({
    font: 'slant',
    width: 100,
    justification: 'center'
});

const result = fig.render('Hello');
console.log(result.result);

Multi-Instance Support

Each instance created with createInstance is fully isolated. This means you can maintain different configurations (font, width, smush modes, etc.) simultaneously without interference.

const fig1 = await figlet.createInstance({ font: 'standard', deutsch: false });
const fig2 = await figlet.createInstance({ font: 'standard', deutsch: true });

// [ will render differently in each instance
console.log(fig1.render('[').result);
console.log(fig2.render('[').result);

Options

| Option | Type | Description | |--------|------|-------------| | font | string | Font name to use | | width | number | Output width (default: 80) | | justification | 'left' \| 'center' \| 'right' \| 'auto' | Text alignment | | colors | string[] | Array of color names or hex codes (requires HTML parser) | | parser | 'terminal' \| 'terminal-color' \| 'html' | Output format | | smushMode | number | Smushing mode (0: kerning, -1: full width, 1-63: smushing) | | rightToLeft | number | Text direction (0: left, 1: right, -1: auto) | | paragraph | boolean | Enable paragraph mode | | deutsch | boolean | Enable Deutsch character mapping ([ -> Ä, etc.) |

FigletInstance Methods

All instance methods return a boolean indicating success, except render, renderWithFont, listFonts, and getVersion.

  • render(text: string): RenderResult
  • renderWithFont(text: string, font: string): RenderResult
  • setFont(font: string): FontResult
  • setWidth(width: number): boolean
  • setJustification(align: 'left' | 'center' | 'right' | 'auto'): boolean
  • setColors(colors: string[]): boolean
  • setParser(parser: string): boolean
  • setSmushMode(mode: number): boolean
  • setRightToLeft(mode: number): boolean
  • setParagraph(enabled: boolean): boolean
  • setDeutsch(enabled: boolean): boolean
  • addControlFile(name: string): boolean
  • clearControlFiles(): boolean

Available Fonts

The package includes 146 built-in fonts from the FIGlet font database:

Popular fonts: standard, banner, big, block, slant, shadow, script, small, doom, graffiti, starwars, larry3d, colossal, gothic, epic, poison, roman, rounded, speed, stellar, and many more!

Use listFonts() to see all available fonts.

Browser Usage

<script src="https://unpkg.com/figlet-go/dist/wasm_exec.js"></script>
<script type="module">
import figlet from 'https://unpkg.com/figlet-go/dist/index.mjs';

// Initialize with WASM path
await figlet.init('https://unpkg.com/figlet-go/dist/figlet.wasm');

const art = await figlet.render('Hello Web!');
console.log(art);
</script>

Animation Support

FIGlet-Go supports high-performance animations! You can list available animation types and generate frames directly:

// List available animations
const animations = await figlet.listAnimations();
// ['reveal', 'scroll', 'rain', 'wave', 'explosion']

// Generate frames for an animation
const frames = await figlet.generateAnimation('Hello!', 'wave', 50);

// Each frame contains:
// - content: The rendered string for this frame
// - delay: Suggested delay in ms
// - baselineOffset: Vertical offset for the frame
console.log(frames[0].content);

Stable Color Mapping

All animations support high-fidelity, character-pinned coloring. Characters maintain their colors as they move, ensuring smooth and professional effects. 坐

TypeScript Support

Full TypeScript definitions are included:

import figlet, { FigletInstance } from 'figlet-go';

const art: string = await figlet.render('Hello');
const fonts: string[] = await figlet.listFonts();

const instance: FigletInstance = await figlet.createInstance({
    font: 'slant',
    justification: 'center'
});

Examples

Generate multiple styles

const figlet = require('figlet-go');

const fonts = ['standard', 'slant', 'banner', 'big'];

for (const font of fonts) {
    console.log(`\n--- ${font} ---\n`);
    const art = await figlet.renderWithFont('Hello', font);
    console.log(art);
}

Custom width and alignment

const fig = await figlet.createInstance({
    font: 'small',
    width: 60,
    justification: 'center'
});

const result = fig.render('Centered');
console.log(result.result);

Performance

This package uses WebAssembly compiled from Go, providing:

  • Fast rendering: Native-speed text generation
  • 146 fonts: All fonts from figlet.org embedded
  • Consistent output: Same results across all platforms
  • Multi-Instance: Isolated configurations for concurrent use

Development

Running Tests

To run the test suite, you need to have Node.js and Go installed.

# Run from the root directory
make test-npm

# Or from the npm directory
cd npm
npm install
npm test

Links

License

BSD-3-Clause © Leandro Ferreira

Based on FIGlet by Glenn Chappell, Ian Chai, John Cowan, Christiaan Keet, and Claudio Matsuoka.