UNPKG

og-images-generator

Version:

Generate OG images from a static folder and / or a middleware. Extract metadata from HTML pages. No headless browser involved. Comes as a CLI, API or plugins.

12 lines (11 loc) 396 B
import fs from 'node:fs'; import crypto from 'node:crypto'; export function save(data, destination, type) { let toWrite = data; if (type === 'json') toWrite = JSON.stringify(data, null, 2); fs.writeFileSync(process.cwd() + '/test/__artefacts__/' + destination, toWrite); } export function hash(data) { return crypto.createHash('md5').update(String(data)).digest('hex'); }