@soymaycol/mayhtml
v1.0.0
Published
Módulo para capturar screenshots de HTML usando CatBox y NightAPI
Maintainers
Readme
MayHTML 📸
Un módulo de Node.js que captura screenshots de contenido HTML usando CatBox y NightAPI.
🔧 Instalación
npm install mayhtml📖 Uso Básico
Capturar HTML directo
const MayHTML = require('mayhtml');
const mayhtml = new MayHTML();
const htmlContent = `
<!DOCTYPE html>
<html>
<head>
<title>Mi Página</title>
<style>
body {
font-family: Arial;
background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
padding: 40px;
}
</style>
</head>
<body>
<h1>¡Hola Mundo!</h1>
<p>Este HTML será capturado como imagen</p>
</body>
</html>
`;
async function capturar() {
try {
const rutaImagen = await mayhtml.captureHTML(
htmlContent,
'./screenshots/', // Directorio de descarga
'mi-captura' // Nombre del archivo
);
console.log('Imagen guardada en:', rutaImagen);
} catch (error) {
console.error('Error:', error.message);
}
}
capturar();Capturar desde archivo HTML
const mayhtml = new MayHTML();
async function capturarArchivo() {
try {
const rutaImagen = await mayhtml.captureFromFile(
'./mi-pagina.html', // Archivo HTML
'./capturas/', // Directorio de descarga
'captura-especial' // Nombre personalizado
);
console.log('Captura guardada:', rutaImagen);
} catch (error) {
console.error('Error:', error.message);
}
}
capturarArchivo();Hecho ️por SoyMaycol con ♥ para la comunidad de desarrolladores
