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

qrcode-generator-sabai

v1.1.6

Published

qrcode-generator-sabai is a Node.js package designed to simplify QR code generation from various payloads to images. It offers ease of use and extensive customization options.

Downloads

122

Readme

qrcode-generator-sabai

npm version npm License

⚠️ Important: This package is designed for server-side (Node.js) applications only and will not work in a browser environment.


Sample QR code

Overview

qrcode-generator-sabai is a server-side Node.js package for generating QR codes in PNG, SVG, or Base64 formats with customization options such as size, error correction levels, and embedded logos.

📌 Server-Side Only

This package does NOT work in the browser because:

  • It uses Node.js file system (fs) to save QR codes as images.
  • It depends on server-side modules that are not available in browser environments.
  • If you need a frontend QR code generator, consider browser-compatible libraries like qrcode.

Use This Package For:

  • Backend APIs (e.g., Express.js, NestJS, Fastify)
  • Generating QR codes on the server and sending them to clients
  • Saving QR code images or Base64 data in databases or cloud storage

🚫 Do NOT Use This Package For:

  • Frontend/Browser apps (it will fail due to missing Node.js dependencies)

📌 Quick Start (Server-Side Usage)

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    await QR.generate('https://github.com/iamlex01/qrcode-generator-sabai', {
        filePath: './public/images',
        fileName: 'qr-code.png'
    });
    console.log('QR Code saved successfully!');
}

generateQRCode().catch(console.error);

📖 Detailed Usage

1️⃣ Generate a PNG QR Code

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    await QR.generate('https://example.com', {
        size: 300,
        errorCorrection: 'Q',
        format: 'png',
        filePath: './public/images',
        fileName: 'qr-code.png'
    });
    console.log('QR Code saved successfully!');
}

generateQRCode().catch(console.error);

2️⃣ Generate an SVG QR Code as a String

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    const svgString = await QR.generate('https://example.com', {
        size: 400,
        errorCorrection: 'H',
        format: 'svg'
    });
    console.log('QR Code SVG:', svgString);
}

generateQRCode().catch(console.error);

3️⃣ Generate an SVG QR Code and Save as a File

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    await QR.generate('https://example.com', {
        size: 400,
        errorCorrection: 'H',
        format: 'svg',
        filePath: './public/images',
        fileName: 'qr-code.svg'
    });
    console.log('QR Code SVG file saved successfully!');
}

generateQRCode().catch(console.error);

4️⃣ Generate a Base64 QR Code

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    const base64 = await QR.generate('https://example.com', {
        size: 500,
        errorCorrection: 'M',
        format: 'base64'
    });
    console.log('QR Code Base64:', base64);
}

generateQRCode().catch(console.error);

5️⃣ Generate a PNG QR Code with a Logo

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    await QR.generate('https://example.com', {
        size: 400,
        logoPath: './logo.png', 
        format: 'png',
        filePath: './public/images',
        fileName: 'qr-code-logo.png'
    });
    console.log('PNG QR Code with logo generated!');
}

generateQRCode().catch(console.error);

6️⃣ Generate an SVG QR Code with a Logo

const { QR } = require('qrcode-generator-sabai');

async function generateQRCode() {
    await QR.generate('https://example.com', {
        size: 400,
        logoPath: './logo.svg', 
        format: 'svg',
        filePath: './public/images',
        fileName: 'qr-code-logo.svg'
    });
    console.log('SVG QR Code with logo generated!');
}

generateQRCode().catch(console.error);

🎯 QR Code Options

| Option | Type | Default | Description | |-----------------|-----------|---------|-------------| | size | number | 200 | QR code size in pixels (applies to PNG, SVG, and Base64). | | errorCorrection | 'L' \| 'M' \| 'Q' \| 'H' | 'M' | Set the error correction level (applies to PNG, SVG, and Base64). | | format | 'png' \| 'svg' \| 'base64' | 'png' | Choose output format. | | filePath | string | null | Directory path to save the QR code file (only for png and svg). | | fileName | string | null | File name for the saved QR code (only for png and svg). | | logoPath | string | null | Path to an image file (PNG or SVG) to embed in the QR code (applies to png and svg). |


🔄 Error Correction Levels

| Level | Error Resistance | |--------|------------------| | L (Low) | ~7% | | M (Medium) | ~15% | | Q (Quartile) | ~25% | | H (High) | ~30% |


📜 License

qrcode-generator-sabai is licensed under the MIT License.