Skip to content

Installation

Terminal window
npm install @teamflojo/floimg

Or with your preferred package manager:

Terminal window
pnpm add @teamflojo/floimg
yarn add @teamflojo/floimg

floimg uses a plugin architecture. Install only the generators you need:

Terminal window
# Charts via Chart.js
npm install @teamflojo/floimg-quickchart
# Mermaid diagrams
npm install @teamflojo/floimg-mermaid
# QR codes
npm install @teamflojo/floimg-qr
# D3 visualizations
npm install @teamflojo/floimg-d3
# Screenshots via Playwright
npm install @teamflojo/floimg-screenshot

Create a simple test file:

test.ts
import createClient from '@teamflojo/floimg';
import qr from '@teamflojo/floimg-qr';
const floimg = createClient();
floimg.registerGenerator(qr());
const qrCode = await floimg.generate({
generator: 'qr',
params: { text: 'https://floimg.com' }
});
await floimg.save(qrCode, './test-qr.png');
console.log('QR code saved to test-qr.png');

Run it:

Terminal window
npx tsx test.ts

You should see a QR code saved to test-qr.png.