qrbit 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -7
- package/dist/native.cjs +69 -53
- package/dist/native.d.cts +2 -6
- package/dist/native.d.ts +2 -6
- package/dist/native.js +70 -54
- package/dist/qrbit.cjs +54 -3
- package/dist/qrbit.cjs.map +1 -1
- package/dist/qrbit.d.cts +29 -0
- package/dist/qrbit.d.ts +29 -0
- package/dist/qrbit.darwin-arm64.node +0 -0
- package/dist/qrbit.darwin-x64.node +0 -0
- package/dist/qrbit.js +55 -6
- package/dist/qrbit.js.map +1 -1
- package/dist/qrbit.linux-x64-gnu.node +0 -0
- package/dist/qrbit.linux-x64-musl.node +0 -0
- package/dist/qrbit.win32-x64-msvc.node +0 -0
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ A fast QR code generator with logo embedding support, built with Rust and native
|
|
|
17
17
|
- **Cross-platform**: Works on iOS, Windows, Linux, and macOS
|
|
18
18
|
- **Logo embedding**: Add custom logos to your QR codes with no need for node canvas!
|
|
19
19
|
- **Customizable**: Custom colors, sizes, and margins
|
|
20
|
-
- **Multiple formats**: Generate SVG and
|
|
20
|
+
- **Multiple formats**: Generate SVG, PNG, and JPEG outputs
|
|
21
21
|
- **Scalable**: With caching you can also use a secondary store for persistence
|
|
22
22
|
- **Well-tested**: Comprehensive test coverage with Vitest
|
|
23
23
|
- **Maintained**: Actively maintained with regular updates
|
|
@@ -64,6 +64,14 @@ const svg = await qr.toSvg();
|
|
|
64
64
|
console.log(svg); // here is the svg with an embedded logo!
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
```javascript
|
|
68
|
+
const qr = new QrBit({
|
|
69
|
+
text: "https://github.com/jaredwray/qrbit",
|
|
70
|
+
logo: '/path/to/logo.png',
|
|
71
|
+
size: 200 });
|
|
72
|
+
const png = await qr.toPng(); // buffer of the png!
|
|
73
|
+
```
|
|
74
|
+
|
|
67
75
|
# API
|
|
68
76
|
|
|
69
77
|
## constructor(options: QrOptions)
|
|
@@ -84,6 +92,11 @@ interface QrOptions {
|
|
|
84
92
|
foregroundColor?: string; // Foreground color (default: "#000000")
|
|
85
93
|
cache?: Cacheable | boolean; // Caching configuration (default: true)
|
|
86
94
|
}
|
|
95
|
+
|
|
96
|
+
interface toOptions {
|
|
97
|
+
cache?: boolean; // Enable/disable caching (default: true)
|
|
98
|
+
quality?: number; // JPEG quality 1-100 (default: 90) - only for toJpg methods
|
|
99
|
+
}
|
|
87
100
|
```
|
|
88
101
|
|
|
89
102
|
**Example:**
|
|
@@ -177,7 +190,7 @@ qr.cache = false; // Disable caching
|
|
|
177
190
|
|
|
178
191
|
## Methods
|
|
179
192
|
|
|
180
|
-
### .toSvg(options?: toOptions)
|
|
193
|
+
### .toSvg(options?: toOptions)
|
|
181
194
|
|
|
182
195
|
Generate SVG QR code with optional caching. Uses native QRCode library for simple cases, Rust implementation for logos.
|
|
183
196
|
|
|
@@ -195,7 +208,7 @@ console.log(svg); // <svg xmlns="http://www.w3.org/2000/svg"...
|
|
|
195
208
|
const svgNoCache = await qr.toSvg({ cache: false });
|
|
196
209
|
```
|
|
197
210
|
|
|
198
|
-
### .toSvgFile(filePath: string, options?: toOptions)
|
|
211
|
+
### .toSvgFile(filePath: string, options?: toOptions)
|
|
199
212
|
|
|
200
213
|
Generate SVG QR code and save it to a file. Creates directories if they don't exist.
|
|
201
214
|
|
|
@@ -213,7 +226,7 @@ await qr.toSvgFile("./output/qr-code.svg");
|
|
|
213
226
|
await qr.toSvgFile("./output/qr-code.svg", { cache: false });
|
|
214
227
|
```
|
|
215
228
|
|
|
216
|
-
### .toPng(options?: toOptions)
|
|
229
|
+
### .toPng(options?: toOptions)
|
|
217
230
|
|
|
218
231
|
Generate PNG QR code with optional caching. Uses high-performance SVG to PNG conversion.
|
|
219
232
|
|
|
@@ -233,7 +246,7 @@ fs.writeFileSync("qr-code.png", pngBuffer);
|
|
|
233
246
|
const pngNoCache = await qr.toPng({ cache: false });
|
|
234
247
|
```
|
|
235
248
|
|
|
236
|
-
### .toPngFile(filePath: string, options?: toOptions)
|
|
249
|
+
### .toPngFile(filePath: string, options?: toOptions)
|
|
237
250
|
|
|
238
251
|
Generate PNG QR code and save it to a file. Creates directories if they don't exist.
|
|
239
252
|
|
|
@@ -251,6 +264,90 @@ await qr.toPngFile("./output/qr-code.png");
|
|
|
251
264
|
await qr.toPngFile("./output/qr-code.png", { cache: false });
|
|
252
265
|
```
|
|
253
266
|
|
|
267
|
+
### .toJpg(options?: toOptions)
|
|
268
|
+
|
|
269
|
+
Generate JPEG QR code with optional caching and quality control. Uses high-performance SVG to JPEG conversion.
|
|
270
|
+
|
|
271
|
+
**Parameters:**
|
|
272
|
+
- `options.cache?: boolean` - Whether to use caching (default: true)
|
|
273
|
+
- `options.quality?: number` - JPEG quality from 1-100 (default: 90)
|
|
274
|
+
|
|
275
|
+
**Returns:** Promise<Buffer> - The JPEG buffer
|
|
276
|
+
|
|
277
|
+
```javascript
|
|
278
|
+
const qr = new QrBit({ text: "Hello World" });
|
|
279
|
+
const jpgBuffer = await qr.toJpg();
|
|
280
|
+
|
|
281
|
+
// With high quality
|
|
282
|
+
const jpgHigh = await qr.toJpg({ quality: 95 });
|
|
283
|
+
|
|
284
|
+
// With compression for smaller file size
|
|
285
|
+
const jpgCompressed = await qr.toJpg({ quality: 70 });
|
|
286
|
+
|
|
287
|
+
// Save to file
|
|
288
|
+
fs.writeFileSync("qr-code.jpg", jpgBuffer);
|
|
289
|
+
|
|
290
|
+
// Without caching
|
|
291
|
+
const jpgNoCache = await qr.toJpg({ cache: false, quality: 85 });
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### .toJpgFile(filePath: string, options?: toOptions)
|
|
295
|
+
|
|
296
|
+
Generate JPEG QR code and save it to a file. Creates directories if they don't exist.
|
|
297
|
+
|
|
298
|
+
**Parameters:**
|
|
299
|
+
- `filePath: string` - The file path where to save the JPEG
|
|
300
|
+
- `options.cache?: boolean` - Whether to use caching (default: true)
|
|
301
|
+
- `options.quality?: number` - JPEG quality from 1-100 (default: 90)
|
|
302
|
+
|
|
303
|
+
**Returns:** Promise<void>
|
|
304
|
+
|
|
305
|
+
```javascript
|
|
306
|
+
const qr = new QrBit({ text: "Hello World" });
|
|
307
|
+
await qr.toJpgFile("./output/qr-code.jpg");
|
|
308
|
+
|
|
309
|
+
// With high quality
|
|
310
|
+
await qr.toJpgFile("./output/qr-code.jpg", { quality: 95 });
|
|
311
|
+
|
|
312
|
+
// With compression
|
|
313
|
+
await qr.toJpgFile("./output/qr-code.jpg", { quality: 70, cache: false });
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Static Methods
|
|
317
|
+
|
|
318
|
+
#### QrBit.convertSvgToPng(svgContent: string, width?: number, height?: number)
|
|
319
|
+
|
|
320
|
+
Convert SVG content to PNG buffer using the native Rust implementation.
|
|
321
|
+
|
|
322
|
+
**Parameters:**
|
|
323
|
+
- `svgContent: string` - The SVG content as a string
|
|
324
|
+
- `width?: number` - Optional width for the PNG output
|
|
325
|
+
- `height?: number` - Optional height for the PNG output
|
|
326
|
+
|
|
327
|
+
**Returns:** Buffer - The PNG buffer
|
|
328
|
+
|
|
329
|
+
```javascript
|
|
330
|
+
const svg = '<svg>...</svg>';
|
|
331
|
+
const pngBuffer = QrBit.convertSvgToPng(svg, 400, 400);
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### QrBit.convertSvgToJpeg(svgContent: string, width?: number, height?: number, quality?: number)
|
|
335
|
+
|
|
336
|
+
Convert SVG content to JPEG buffer using the native Rust implementation.
|
|
337
|
+
|
|
338
|
+
**Parameters:**
|
|
339
|
+
- `svgContent: string` - The SVG content as a string
|
|
340
|
+
- `width?: number` - Optional width for the JPEG output
|
|
341
|
+
- `height?: number` - Optional height for the JPEG output
|
|
342
|
+
- `quality?: number` - JPEG quality from 1-100 (default: 90)
|
|
343
|
+
|
|
344
|
+
**Returns:** Buffer - The JPEG buffer
|
|
345
|
+
|
|
346
|
+
```javascript
|
|
347
|
+
const svg = '<svg>...</svg>';
|
|
348
|
+
const jpegBuffer = QrBit.convertSvgToJpeg(svg, 400, 400, 85);
|
|
349
|
+
```
|
|
350
|
+
|
|
254
351
|
# Benchmarks
|
|
255
352
|
|
|
256
353
|
## QR Codes SVG (No Logo)
|
|
@@ -270,7 +367,13 @@ await qr.toPngFile("./output/qr-code.png", { cache: false });
|
|
|
270
367
|
| QRCode toBuffer (v1.5.4) | -49% | 804 | 1ms | ±0.77% | 794 |
|
|
271
368
|
| styled-qr-code-node toBuffer (v1.5.2) | -85% | 238 | 4ms | ±0.74% | 238 |
|
|
272
369
|
|
|
273
|
-
|
|
370
|
+
## QR Codes JPG (No Logo)
|
|
371
|
+
| name | summary | ops/sec | time/op | margin | samples |
|
|
372
|
+
|-----------------------------------------|:---------:|----------:|----------:|:--------:|----------:|
|
|
373
|
+
| QrBit toJpg (v1.2.0) | 🥇 | 663 | 2ms | ±0.37% | 662 |
|
|
374
|
+
| styled-qr-code-node toBuffer (v1.5.2) | -36% | 424 | 2ms | ±2.13% | 418 |
|
|
375
|
+
|
|
376
|
+
`Rust` is used for `toPng()` and `toJpg` to optimize performance for image generation and heavy image processing without needing node `canvas` installed.
|
|
274
377
|
|
|
275
378
|
## QR Codes with Embedded Logos
|
|
276
379
|
| name | summary | ops/sec | time/op | margin | samples |
|
|
@@ -422,7 +525,62 @@ await qr.toPngFile("10_buffer_logo.png");
|
|
|
422
525
|
```
|
|
423
526
|

|
|
424
527
|
|
|
425
|
-
|
|
528
|
+
## 11. High Quality JPEG
|
|
529
|
+
JPEG format with high quality setting.
|
|
530
|
+
```javascript
|
|
531
|
+
const qr = new QrBit({
|
|
532
|
+
text: "High Quality JPEG",
|
|
533
|
+
size: 300
|
|
534
|
+
});
|
|
535
|
+
await qr.toJpgFile("11_jpg_high_quality.jpg", { quality: 95 });
|
|
536
|
+
```
|
|
537
|
+

|
|
538
|
+
|
|
539
|
+
## 12. JPEG with Logo and Blue Theme
|
|
540
|
+
JPEG with embedded logo and custom blue background.
|
|
541
|
+
```javascript
|
|
542
|
+
const qr = new QrBit({
|
|
543
|
+
text: "JPEG with Logo",
|
|
544
|
+
logo: "./logo.png",
|
|
545
|
+
size: 400,
|
|
546
|
+
logoSizeRatio: 0.25,
|
|
547
|
+
backgroundColor: "#2196F3",
|
|
548
|
+
foregroundColor: "#FFFFFF"
|
|
549
|
+
});
|
|
550
|
+
await qr.toJpgFile("12_jpg_logo_blue.jpg", { quality: 90 });
|
|
551
|
+
```
|
|
552
|
+

|
|
553
|
+
|
|
554
|
+
## 13. Compressed JPEG with Green Theme
|
|
555
|
+
JPEG with lower quality for smaller file size.
|
|
556
|
+
```javascript
|
|
557
|
+
const qr = new QrBit({
|
|
558
|
+
text: "https://github.com/jaredwray/qrbit",
|
|
559
|
+
size: 300,
|
|
560
|
+
backgroundColor: "#4CAF50",
|
|
561
|
+
foregroundColor: "#FFFFFF"
|
|
562
|
+
});
|
|
563
|
+
await qr.toJpgFile("13_jpg_compressed_green.jpg", { quality: 70 });
|
|
564
|
+
```
|
|
565
|
+

|
|
566
|
+
|
|
567
|
+
## 14. JPEG with Buffer Logo and Orange Theme
|
|
568
|
+
JPEG using buffer-based logo with orange background.
|
|
569
|
+
```javascript
|
|
570
|
+
const logoBuffer = fs.readFileSync("./logo.png");
|
|
571
|
+
const qr = new QrBit({
|
|
572
|
+
text: "JPEG Buffer Logo",
|
|
573
|
+
logo: logoBuffer,
|
|
574
|
+
size: 350,
|
|
575
|
+
logoSizeRatio: 0.2,
|
|
576
|
+
backgroundColor: "#FF9800",
|
|
577
|
+
foregroundColor: "#FFFFFF"
|
|
578
|
+
});
|
|
579
|
+
await qr.toJpgFile("14_jpg_buffer_logo_orange.jpg", { quality: 85 });
|
|
580
|
+
```
|
|
581
|
+

|
|
582
|
+
|
|
583
|
+
These examples demonstrate the versatility and capabilities of QrBit for generating QR codes with various customizations, from simple text encoding to complex styled codes with embedded logos, supporting SVG, PNG, and JPEG formats with quality control.
|
|
426
584
|
|
|
427
585
|
## Contributing
|
|
428
586
|
|
package/dist/native.cjs
CHANGED
|
@@ -80,8 +80,8 @@ function requireNative() {
|
|
|
80
80
|
try {
|
|
81
81
|
const binding = require('qrbit-android-arm64')
|
|
82
82
|
const bindingPackageVersion = require('qrbit-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '1.
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
83
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
85
|
}
|
|
86
86
|
return binding
|
|
87
87
|
} catch (e) {
|
|
@@ -96,8 +96,8 @@ function requireNative() {
|
|
|
96
96
|
try {
|
|
97
97
|
const binding = require('qrbit-android-arm-eabi')
|
|
98
98
|
const bindingPackageVersion = require('qrbit-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '1.
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
99
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
101
|
}
|
|
102
102
|
return binding
|
|
103
103
|
} catch (e) {
|
|
@@ -108,7 +108,24 @@ function requireNative() {
|
|
|
108
108
|
}
|
|
109
109
|
} else if (process.platform === 'win32') {
|
|
110
110
|
if (process.arch === 'x64') {
|
|
111
|
+
if (process.report?.getReport?.()?.header?.osName?.startsWith?.('MINGW')) {
|
|
112
|
+
try {
|
|
113
|
+
return require('./qrbit.win32-x64-gnu.node')
|
|
114
|
+
} catch (e) {
|
|
115
|
+
loadErrors.push(e)
|
|
116
|
+
}
|
|
111
117
|
try {
|
|
118
|
+
const binding = require('qrbit-win32-x64-gnu')
|
|
119
|
+
const bindingPackageVersion = require('qrbit-win32-x64-gnu/package.json').version
|
|
120
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
121
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
122
|
+
}
|
|
123
|
+
return binding
|
|
124
|
+
} catch (e) {
|
|
125
|
+
loadErrors.push(e)
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
try {
|
|
112
129
|
return require('./qrbit.win32-x64-msvc.node')
|
|
113
130
|
} catch (e) {
|
|
114
131
|
loadErrors.push(e)
|
|
@@ -116,13 +133,14 @@ function requireNative() {
|
|
|
116
133
|
try {
|
|
117
134
|
const binding = require('qrbit-win32-x64-msvc')
|
|
118
135
|
const bindingPackageVersion = require('qrbit-win32-x64-msvc/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '1.
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
136
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
137
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
138
|
}
|
|
122
139
|
return binding
|
|
123
140
|
} catch (e) {
|
|
124
141
|
loadErrors.push(e)
|
|
125
142
|
}
|
|
143
|
+
}
|
|
126
144
|
} else if (process.arch === 'ia32') {
|
|
127
145
|
try {
|
|
128
146
|
return require('./qrbit.win32-ia32-msvc.node')
|
|
@@ -132,8 +150,8 @@ function requireNative() {
|
|
|
132
150
|
try {
|
|
133
151
|
const binding = require('qrbit-win32-ia32-msvc')
|
|
134
152
|
const bindingPackageVersion = require('qrbit-win32-ia32-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '1.
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
153
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
154
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
155
|
}
|
|
138
156
|
return binding
|
|
139
157
|
} catch (e) {
|
|
@@ -148,8 +166,8 @@ function requireNative() {
|
|
|
148
166
|
try {
|
|
149
167
|
const binding = require('qrbit-win32-arm64-msvc')
|
|
150
168
|
const bindingPackageVersion = require('qrbit-win32-arm64-msvc/package.json').version
|
|
151
|
-
if (bindingPackageVersion !== '1.
|
|
152
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
169
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
170
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
153
171
|
}
|
|
154
172
|
return binding
|
|
155
173
|
} catch (e) {
|
|
@@ -167,8 +185,8 @@ function requireNative() {
|
|
|
167
185
|
try {
|
|
168
186
|
const binding = require('qrbit-darwin-universal')
|
|
169
187
|
const bindingPackageVersion = require('qrbit-darwin-universal/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '1.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
188
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
189
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
190
|
}
|
|
173
191
|
return binding
|
|
174
192
|
} catch (e) {
|
|
@@ -183,8 +201,8 @@ function requireNative() {
|
|
|
183
201
|
try {
|
|
184
202
|
const binding = require('qrbit-darwin-x64')
|
|
185
203
|
const bindingPackageVersion = require('qrbit-darwin-x64/package.json').version
|
|
186
|
-
if (bindingPackageVersion !== '1.
|
|
187
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
204
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
205
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
188
206
|
}
|
|
189
207
|
return binding
|
|
190
208
|
} catch (e) {
|
|
@@ -199,8 +217,8 @@ function requireNative() {
|
|
|
199
217
|
try {
|
|
200
218
|
const binding = require('qrbit-darwin-arm64')
|
|
201
219
|
const bindingPackageVersion = require('qrbit-darwin-arm64/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '1.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
220
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
221
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
222
|
}
|
|
205
223
|
return binding
|
|
206
224
|
} catch (e) {
|
|
@@ -219,8 +237,8 @@ function requireNative() {
|
|
|
219
237
|
try {
|
|
220
238
|
const binding = require('qrbit-freebsd-x64')
|
|
221
239
|
const bindingPackageVersion = require('qrbit-freebsd-x64/package.json').version
|
|
222
|
-
if (bindingPackageVersion !== '1.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
240
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
241
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
224
242
|
}
|
|
225
243
|
return binding
|
|
226
244
|
} catch (e) {
|
|
@@ -235,8 +253,8 @@ function requireNative() {
|
|
|
235
253
|
try {
|
|
236
254
|
const binding = require('qrbit-freebsd-arm64')
|
|
237
255
|
const bindingPackageVersion = require('qrbit-freebsd-arm64/package.json').version
|
|
238
|
-
if (bindingPackageVersion !== '1.
|
|
239
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
256
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
257
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
240
258
|
}
|
|
241
259
|
return binding
|
|
242
260
|
} catch (e) {
|
|
@@ -256,8 +274,8 @@ function requireNative() {
|
|
|
256
274
|
try {
|
|
257
275
|
const binding = require('qrbit-linux-x64-musl')
|
|
258
276
|
const bindingPackageVersion = require('qrbit-linux-x64-musl/package.json').version
|
|
259
|
-
if (bindingPackageVersion !== '1.
|
|
260
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
277
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
278
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
261
279
|
}
|
|
262
280
|
return binding
|
|
263
281
|
} catch (e) {
|
|
@@ -272,8 +290,8 @@ function requireNative() {
|
|
|
272
290
|
try {
|
|
273
291
|
const binding = require('qrbit-linux-x64-gnu')
|
|
274
292
|
const bindingPackageVersion = require('qrbit-linux-x64-gnu/package.json').version
|
|
275
|
-
if (bindingPackageVersion !== '1.
|
|
276
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
293
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
277
295
|
}
|
|
278
296
|
return binding
|
|
279
297
|
} catch (e) {
|
|
@@ -290,8 +308,8 @@ function requireNative() {
|
|
|
290
308
|
try {
|
|
291
309
|
const binding = require('qrbit-linux-arm64-musl')
|
|
292
310
|
const bindingPackageVersion = require('qrbit-linux-arm64-musl/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '1.
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
311
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
312
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
313
|
}
|
|
296
314
|
return binding
|
|
297
315
|
} catch (e) {
|
|
@@ -306,8 +324,8 @@ function requireNative() {
|
|
|
306
324
|
try {
|
|
307
325
|
const binding = require('qrbit-linux-arm64-gnu')
|
|
308
326
|
const bindingPackageVersion = require('qrbit-linux-arm64-gnu/package.json').version
|
|
309
|
-
if (bindingPackageVersion !== '1.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
327
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
311
329
|
}
|
|
312
330
|
return binding
|
|
313
331
|
} catch (e) {
|
|
@@ -324,8 +342,8 @@ function requireNative() {
|
|
|
324
342
|
try {
|
|
325
343
|
const binding = require('qrbit-linux-arm-musleabihf')
|
|
326
344
|
const bindingPackageVersion = require('qrbit-linux-arm-musleabihf/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '1.
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
345
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
346
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
347
|
}
|
|
330
348
|
return binding
|
|
331
349
|
} catch (e) {
|
|
@@ -340,8 +358,8 @@ function requireNative() {
|
|
|
340
358
|
try {
|
|
341
359
|
const binding = require('qrbit-linux-arm-gnueabihf')
|
|
342
360
|
const bindingPackageVersion = require('qrbit-linux-arm-gnueabihf/package.json').version
|
|
343
|
-
if (bindingPackageVersion !== '1.
|
|
344
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
361
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
363
|
}
|
|
346
364
|
return binding
|
|
347
365
|
} catch (e) {
|
|
@@ -358,8 +376,8 @@ function requireNative() {
|
|
|
358
376
|
try {
|
|
359
377
|
const binding = require('qrbit-linux-loong64-musl')
|
|
360
378
|
const bindingPackageVersion = require('qrbit-linux-loong64-musl/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '1.
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
379
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
380
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
381
|
}
|
|
364
382
|
return binding
|
|
365
383
|
} catch (e) {
|
|
@@ -374,8 +392,8 @@ function requireNative() {
|
|
|
374
392
|
try {
|
|
375
393
|
const binding = require('qrbit-linux-loong64-gnu')
|
|
376
394
|
const bindingPackageVersion = require('qrbit-linux-loong64-gnu/package.json').version
|
|
377
|
-
if (bindingPackageVersion !== '1.
|
|
378
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
395
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
379
397
|
}
|
|
380
398
|
return binding
|
|
381
399
|
} catch (e) {
|
|
@@ -392,8 +410,8 @@ function requireNative() {
|
|
|
392
410
|
try {
|
|
393
411
|
const binding = require('qrbit-linux-riscv64-musl')
|
|
394
412
|
const bindingPackageVersion = require('qrbit-linux-riscv64-musl/package.json').version
|
|
395
|
-
if (bindingPackageVersion !== '1.
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
413
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
414
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
415
|
}
|
|
398
416
|
return binding
|
|
399
417
|
} catch (e) {
|
|
@@ -408,8 +426,8 @@ function requireNative() {
|
|
|
408
426
|
try {
|
|
409
427
|
const binding = require('qrbit-linux-riscv64-gnu')
|
|
410
428
|
const bindingPackageVersion = require('qrbit-linux-riscv64-gnu/package.json').version
|
|
411
|
-
if (bindingPackageVersion !== '1.
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
429
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
413
431
|
}
|
|
414
432
|
return binding
|
|
415
433
|
} catch (e) {
|
|
@@ -425,8 +443,8 @@ function requireNative() {
|
|
|
425
443
|
try {
|
|
426
444
|
const binding = require('qrbit-linux-ppc64-gnu')
|
|
427
445
|
const bindingPackageVersion = require('qrbit-linux-ppc64-gnu/package.json').version
|
|
428
|
-
if (bindingPackageVersion !== '1.
|
|
429
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
446
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
447
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
430
448
|
}
|
|
431
449
|
return binding
|
|
432
450
|
} catch (e) {
|
|
@@ -441,8 +459,8 @@ function requireNative() {
|
|
|
441
459
|
try {
|
|
442
460
|
const binding = require('qrbit-linux-s390x-gnu')
|
|
443
461
|
const bindingPackageVersion = require('qrbit-linux-s390x-gnu/package.json').version
|
|
444
|
-
if (bindingPackageVersion !== '1.
|
|
445
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
462
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
463
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
446
464
|
}
|
|
447
465
|
return binding
|
|
448
466
|
} catch (e) {
|
|
@@ -461,8 +479,8 @@ function requireNative() {
|
|
|
461
479
|
try {
|
|
462
480
|
const binding = require('qrbit-openharmony-arm64')
|
|
463
481
|
const bindingPackageVersion = require('qrbit-openharmony-arm64/package.json').version
|
|
464
|
-
if (bindingPackageVersion !== '1.
|
|
465
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
482
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
483
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
466
484
|
}
|
|
467
485
|
return binding
|
|
468
486
|
} catch (e) {
|
|
@@ -477,8 +495,8 @@ function requireNative() {
|
|
|
477
495
|
try {
|
|
478
496
|
const binding = require('qrbit-openharmony-x64')
|
|
479
497
|
const bindingPackageVersion = require('qrbit-openharmony-x64/package.json').version
|
|
480
|
-
if (bindingPackageVersion !== '1.
|
|
481
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
498
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
499
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
482
500
|
}
|
|
483
501
|
return binding
|
|
484
502
|
} catch (e) {
|
|
@@ -493,8 +511,8 @@ function requireNative() {
|
|
|
493
511
|
try {
|
|
494
512
|
const binding = require('qrbit-openharmony-arm')
|
|
495
513
|
const bindingPackageVersion = require('qrbit-openharmony-arm/package.json').version
|
|
496
|
-
if (bindingPackageVersion !== '1.
|
|
497
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
514
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
515
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
498
516
|
}
|
|
499
517
|
return binding
|
|
500
518
|
} catch (e) {
|
|
@@ -557,9 +575,7 @@ if (!nativeBinding) {
|
|
|
557
575
|
}
|
|
558
576
|
|
|
559
577
|
module.exports = nativeBinding
|
|
578
|
+
module.exports.convertSvgToJpeg = nativeBinding.convertSvgToJpeg
|
|
560
579
|
module.exports.convertSvgToPng = nativeBinding.convertSvgToPng
|
|
561
|
-
module.exports.generateQr = nativeBinding.generateQr
|
|
562
|
-
module.exports.generateQrPng = nativeBinding.generateQrPng
|
|
563
|
-
module.exports.generateQrPngWithBuffer = nativeBinding.generateQrPngWithBuffer
|
|
564
580
|
module.exports.generateQrSvg = nativeBinding.generateQrSvg
|
|
565
581
|
module.exports.generateQrSvgWithBuffer = nativeBinding.generateQrSvgWithBuffer
|
package/dist/native.d.cts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
export declare function generateQr(options: QrOptions): QrResult
|
|
3
|
+
export declare function convertSvgToJpeg(svgContent: string, width?: number | undefined | null, height?: number | undefined | null, quality?: number | undefined | null): Buffer
|
|
6
4
|
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
9
|
-
export declare function generateQrPngWithBuffer(options: QrOptionsWithBuffer): Buffer
|
|
5
|
+
export declare function convertSvgToPng(svgContent: string, width?: number | undefined | null, height?: number | undefined | null): Buffer
|
|
10
6
|
|
|
11
7
|
export declare function generateQrSvg(options: QrOptions): string
|
|
12
8
|
|
package/dist/native.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
export declare function generateQr(options: QrOptions): QrResult
|
|
3
|
+
export declare function convertSvgToJpeg(svgContent: string, width?: number | undefined | null, height?: number | undefined | null, quality?: number | undefined | null): Buffer
|
|
6
4
|
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
9
|
-
export declare function generateQrPngWithBuffer(options: QrOptionsWithBuffer): Buffer
|
|
5
|
+
export declare function convertSvgToPng(svgContent: string, width?: number | undefined | null, height?: number | undefined | null): Buffer
|
|
10
6
|
|
|
11
7
|
export declare function generateQrSvg(options: QrOptions): string
|
|
12
8
|
|