The AsciiArt object provides a fluent, chainable API to compose different ASCII art effects (fonts, images, tables, borders, etc.) into a single output. You can chain multiple operations together and then resolve the final result using .then() or by providing a callback to the final method in the chain.
Available chainable methods include:
.font(text, fontName, style, callback): Renders text using a specific font..image(options, callback): Renders an image using the provided options..table(options, callback): Renders data in an ASCII table..graph(options, callback): Renders a graph..border(options, callback): Wraps the current result in a border..overlay(text, options, callback): Overlays new text onto the current result at specific x and y coordinates..style(text, styles, callback): Applies ANSI styles to the text..strip(options, callback): Removes ANSI codes from the current result..lines(start, stop, callback): Slices the current result to specific line ranges..join(text, callback): Appends raw text to the current result..artwork(options, callback): Appends artwork from a file.
To use the chain, call the methods sequentially and end with .then(handler) to receive the final string in a Promise-like fashion.
const AsciiArt = require('ascii-art');
// Example: Font with a border and then a style applied
AsciiArt.Font.newReturnContext({ text: 'Hello', font: 'standard' })
.border({ l: '|', r: '|', t: '-', b: '-' })
.then(result => {
console.log(result);
});