QR Code generator: browser/node.js, transparency, logo, border-radius, opacity, PNG/SVG/PDF
Installations
npm install qreator
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=18
Node Version
20.18.0
NPM Version
10.9.0
Score
60.2
Supply Chain
89.9
Quality
84.9
Maintenance
100
Vulnerability
92.4
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (94.15%)
JavaScript (5.85%)
Developer
Short-io
Download Statistics
Total Downloads
14,161
Last Day
28
Last Week
277
Last Month
1,535
Last Year
14,161
GitHub Statistics
24 Stars
254 Commits
5 Forks
1 Watching
14 Branches
14 Contributors
Bundle Size
163.00 B
Minified
139.00 B
Minified + Gzipped
Package Meta Information
Latest Version
9.7.0
Package Id
qreator@9.7.0
Unpacked Size
4.19 MB
Size
829.00 kB
File Count
97
NPM Version
10.9.0
Node Version
20.18.0
Publised On
26 Oct 2024
Total Downloads
Cumulative downloads
Total Downloads
14,161
Last day
-47.2%
28
Compared to previous day
Last week
-3.1%
277
Compared to previous week
Last month
-27.9%
1,535
Compared to previous month
Last year
0%
14,161
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
32
qreator
QR Code generator for browser and node.js with tree shaking and logo support
Overview
- generate image in
png
,svg
andpdf
formats - numeric and alphanumeric modes
- support UTF-8
- supports color customization
- supports logos
- supports border-radius
- tree shaking support
- browser / node.js
Installing
1npm install qreator 2# or 3yarn add qreator
Usage
Example:
1import { getSVG } from "qreator/lib/svg"; 2import { getPNG } from "qreator/lib/png"; // imports canvas implementation in browser and sharp module in node.js 3import { getPDF } from "qreator/lib/pdf"; // this import is large, consider async import 4const svgString = await getSVG("I love QR", { 5 logo: fs.openFileSync("my-logo.svg"), 6 color: "#000000", 7 bgColor: "#FFFFFF", 8}); 9const pngBuffer = await getPNG("I love QR", { 10 logo: fs.openFileSync("my-logo.svg"), 11 color: "rgb(0, 0, 0)", 12 bgColor: "rgb(255, 255, 255)", 13});
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 encodeoptions
: 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 only size 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 | EXPERIMENTAL try 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
No vulnerabilities found.
No security vulnerabilities found.