npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-romcover

v1.0.0

Published

A Node.js library to create retro game console style covers from images.

Downloads

87

Readme

RomCover

Una librería de Node.js para crear carátulas de juegos retro.

Esta librería genera carátulas de juegos que imitan el estilo de varias consolas clásicas. Toma una imagen, la recorta según el aspect ratio de la caja original y le añade una franja lateral con el logo de la consola.

Consolas Soportadas

  • gameboy - Game Boy
  • nes - Nintendo Entertainment System
  • snes - Super Nintendo Entertainment System
  • n64 - Nintendo 64
  • gamecube - GameCube
  • ps1 - PlayStation 1

Instalación

npm install node-romcover

Uso Básico

const { createCover } = require('node-romcover');
const fs = require('fs');

async function generateCover() {
  try {
    // Generar una carátula de Game Boy
    const buffer = await createCover('gameboy', './mi-imagen.jpg');

    // Guardar la carátula generada
    fs.writeFileSync('caratula-gameboy.png', buffer);
    console.log('¡Carátula creada!');
  } catch (error) {
    console.error('Error:', error.message);
  }
}

generateCover();

API

createCover(consoleType, imagePath)

Genera una carátula de juego en el estilo de la consola especificada.

Parámetros:

  • consoleType (string): El tipo de consola. Valores válidos: 'gameboy', 'nes', 'snes', 'n64', 'gamecube', 'ps1'
  • imagePath (string): La ruta al archivo de imagen que se usará como base

Retorna:

  • Promise<Buffer>: Un buffer con la imagen PNG generada

Ejemplo:

const buffer = await createCover('n64', './cover-art.jpg');

supportedConsoles

Un array con todas las consolas soportadas.

Ejemplo:

const { supportedConsoles } = require('node-romcover');
console.log(supportedConsoles); // ['gameboy', 'nes', 'snes', 'n64', 'gamecube', 'ps1']

consoleConfigs

Un objeto con la configuración de cada consola (logos, aspect ratios, etc.).

Ejemplo:

const { consoleConfigs } = require('node-romcover');
console.log(consoleConfigs.gameboy);
// { logo: 'gameboy-logo.png', cropAspectRatio: 1, logoWidth: 80, placement: 'side' }

Ejemplos

Generar múltiples carátulas

const { createCover, supportedConsoles } = require('node-romcover');
const fs = require('fs');

async function generateAllCovers(imagePath) {
  for (const console of supportedConsoles) {
    const buffer = await createCover(console, imagePath);
    fs.writeFileSync(`cover-${console}.png`, buffer);
    console.log(`Carátula de ${console} creada`);
  }
}

generateAllCovers('./my-game-art.jpg');

Usar con diferentes formatos de imagen

La librería acepta cualquier formato de imagen soportado por el paquete canvas de Node.js (JPEG, PNG, etc.).

const { createCover } = require('node-romcover');
const fs = require('fs');

// Funciona con JPG
const jpgBuffer = await createCover('snes', './game.jpg');
fs.writeFileSync('cover-snes.png', jpgBuffer);

// También funciona con PNG
const pngBuffer = await createCover('nes', './game.png');
fs.writeFileSync('cover-nes.png', pngBuffer);

Ejemplos de Uso Avanzado

El repositorio incluye ejemplos adicionales en la carpeta examples/:

Ejemplo Básico

npm run example:basic -- ./tu-imagen.jpg gameboy

Ejemplo de API Web (opcional)

Si deseas usar la librería como una API web, hay un servidor de Express de ejemplo:

npm run example:api

Luego puedes hacer peticiones POST:

curl -X POST \
  http://localhost:3000/api/create/nes \
  -F "[email protected]" \
  --output caratula-nes.png

Desarrollo

Instalación para desarrollo

git clone <URL_DEL_REPOSITORIO>
cd RomCoverApi
npm install

Ejecutar tests

npm test

Linting

npm run lint
npm run lint:fix

Requisitos

  • Node.js >= 14
  • La librería canvas requiere dependencias nativas. Consulta la documentación de node-canvas para más información sobre la instalación en tu sistema operativo.

Licencia

MIT

Contribuciones

Las contribuciones son bienvenidas. Por favor, abre un issue o un pull request.