There are a lot of libraries to do this. I use ansilove.js[0], which renders to canvas, so I save on the expense of keeping 10G of rendered images online (at the expense of my users compute times).
Ansilove.js is a variant of Ansilove, which was originally written in PHP [1], but has been ported to other languages [2], too.
There are a bunch of other renderers too like piece [3] and Pablo [4].