fast_qr
is approximately 6-7 times faster than qrcode
, see benchmarks
You can create a QR as
- Raw matrix, well suited for custom usage
- Vectorized image, well suited for web usage
- Image, well suited for mobile / print usage
Usage
Rust
Examples
You can run the examples with:
They are all explained in detail below.
Converts QRCode
to Unicode
use ConvertError;
use QRBuilder;
Converts QRCode
to SVG docs.rs
Note: It requires the svg
feature
use ConvertError;
use ;
use QRBuilder;
Converts QRCode
to an image docs.rs
Note: It requires the image
feature
use ConvertError;
use ;
use QRBuilder;
JavaScript / Typescript
Installation
# Or
Create an svg
/// Once `init` is called, `qr_svg` can be called any number of times
import init from '/pkg/fast_qr.js'
const options =
.
.
. // Can be a URL or a base64 encoded image
.
.;
// Using then / catch:
.
.;
// Or using modern async await:
await ;
Build WASM
WASM module also exists in NPM registry
Package is named fast_qr
and can be installed like so :
npm install --save fast_qr
WASM module might be bundled
Find a bundled version in the latest release.
WASM module can be built from source
# wasm-pack publish pkg # Creates an archive & publish it to npm
Benchmarks
According to the following benchmarks, fast_qr
is approximately 6-7x faster than qrcode
.
Benchmark | Lower | Estimate | Upper | |
---|---|---|---|---|
V03H/qrcode | 524.30 us | 535.02 us | 547.13 us | |
V03H/fast_qr | 82.079 us | 82.189 us | 82.318 us | fast_qr is 6.51x faster |
V10H/qrcode | 2.1105 ms | 2.1145 ms | 2.1186 ms | |
V10H/fast_qr | 268.70 us | 269.28 us | 269.85 us | fast_qr is 7.85x faster |
V40H/qrcode | 18.000 ms | 18.037 ms | 18.074 ms | |
V40H/fast_qr | 2.4313 ms | 2.4362 ms | 2.4411 ms | fast_qr is 7.40x faster |
More benchmarks can be found in /benches folder.