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 🙏

© 2024 – Pkg Stats / Ryan Hefner

qreator

v9.7.0

Published

QR Code generator for browser and node.js with tree shaking and logo support

Downloads

2,291

Readme

qreator

npm version

QR Code generator for browser and node.js with tree shaking and logo support

image

Overview

  • generate image in png, svg and pdf formats
  • numeric and alphanumeric modes
  • support UTF-8
  • supports color customization
  • supports logos
  • supports border-radius
  • tree shaking support
  • browser / node.js

Releases

Installing

npm install qreator
# or
yarn add qreator

Usage

Example:

import { getSVG } from "qreator/lib/svg";
import { getPNG } from "qreator/lib/png"; // imports canvas implementation in browser and sharp module in node.js
import { getPDF } from "qreator/lib/pdf"; // this import is large, consider async import
const svgString = await getSVG("I love QR", {
    logo: fs.openFileSync("my-logo.svg"),
    color: "#000000",
    bgColor: "#FFFFFF",
});
const pngBuffer = await getPNG("I love QR", {
    logo: fs.openFileSync("my-logo.svg"),
    color: "rgb(0, 0, 0)",
    bgColor: "rgb(255, 255, 255)",
});

More examples

Syntax

  • getPNG(text, [options]): Readable stream with image data.
  • getSVG(text, [options]): Readable stream with image data.
  • getPDF(text, [options]): Readable stream with image data.

Options

  • text: text to encode
  • options: additional image options object

Additional Options

| Name | Description | Type | Possible Values | Default | | :------------: | :------------------------------------------------: | :---------: | :-------------------: | :--------------------------------------: | | ec_level | error correction level | string | L, M, Q, H | M | | type | image type | string | png, svg, pdf | png | | size | png and svg onlysize of one module in pixels | number | 0 - n | 5 (png)0 (others) | | margin | white space around QR image in modules | number | 0 - n | 4 (png)1 (others) | | parse_url | EXPERIMENTALtry to optimize QR-code for URLs | boolean | true, false | false | | logo | buffer with png/jpeg image | ArrayBuffer | - | undefined | | logoWidth | height of logo in percent | number | 0 - 100 | 20 | | logoHeight | width of logo in percent | number | 0 - 100 | 20 | | color | module color in rgba or hex format | number | #000000 - #000000 | #000000(black with 100% opacity) | | bgColor | background color in rgba or hex format | number | #000000 - #FFFFFF | #FFFFFF(white with 100% opacity) | | borderRadius | border-radius (in pixels) | number | 0 - size / 2 | 0 | | noExcavate | don't remove partially covered modules | boolean | true, false | false |

Benchmarks

getPNG x 229 ops/sec ±0.45% (84 runs sampled)
getPDF x 186 ops/sec ±24.91% (86 runs sampled)
getSVG x 2,482 ops/sec ±0.18% (90 runs sampled)
getPNG with logo x 69.96 ops/sec ±0.72% (68 runs sampled)
getPDF with logo x 44.83 ops/sec ±9.52% (77 runs sampled)
getSVG with logo x 2,494 ops/sec ±0.19% (88 runs sampled)

TODO

  • Use lighter versions of PDF library