@ascii-kit/svg
- API documentation
Functions
svg2ascii()
ts
function svg2ascii(input: string, opts?: Svg2AsciiOptions): Promise<string>
Converts a SVG string to an ASCII art string.
Parameters
Parameter | Type | Description |
---|---|---|
input | string | The SVG string to convert. |
opts ? | Svg2AsciiOptions | Optional options. |
Returns
Promise
<string
>
A promise that resolves with the ASCII art string.
Example
ts
const input = `
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="100" cy="100" r="50" fill="#FF0000"/>
</svg>
`
const ascii = await svg2ascii( input )
console.log( ascii )