html-as
v1.0.2
Published
A Node.js module providing functions for asynchronous HTML conversion and image download. Simplify tasks such as converting HTML content to images and initiating downloads with ease.
Downloads
1
Maintainers
Readme
html-as
html-as
is a simple npm module that provides a function for asynchronously converting the content of an HTML element to an image and initiating the download. It uses the popular html2canvas
library under the hood.
Installation
npm install html-as
Usage
import { downloadHtmlAsImage } from 'html-as';
// Defining an asynchronous function to download an HTML element as an image.
const downloadHtmlElementAsImage = async () => {
const element = document.body;
await downloadHtmlAsImage(element, 'body_image', 'jpeg', 2);
}
Error Handling
Any errors that occur during the process are logged to the console.
Dependencies
License
This project is licensed under the MIT License - see the LICENSE file for details.