node-dom-to-image is a library which converts any DOM node into a downloadable image.
npm install node-dom-to-image
Then load
/* in ES 6 */
import domtoimage from 'node-dom-to-image';
/* in ES 5 */
var domtoimage = require('node-dom-to-image');
import domToImage from 'node-dom-to-image'
const anyFunction = () => {
const node = document.querySelector('.example')
domToImage(node, 'example')
}
anyFunction() // This will download the image
Gabriel Cuenca
MIT