renderScreen
renderScreen(content, options)
Asynchronous function that renders a terminal screenshot to svg or png, or to a data storage format (json or yaml), depending on the output format specified by the output
option.
Returns a promise that resolves either a string
if the output
format option is 'svg'
, 'json'
, or 'yaml'
, or a Buffer
if the output format is 'png'
.
Arguments
contentstring
Screen content to render
optionsObject
A config object to specify the configuration options listed below.
Usage
Here is an example of rendering a simple screenshot to svg:
import { renderScreen } from 'cli-screencast';
import chalk from 'chalk';
renderScreen(
`Hello ${chalk.yellow('World!')}`,
{ columns: 50, rows: 20 },
).then((svg) => {
// Use or save the generated SVG string here
});
result