qrbit 1.2.0 → 1.3.1

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 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 PNG outputs
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): Promise<string>
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): Promise<void>
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): Promise<Buffer>
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): Promise<void>
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
- `Rust` is used for `toPng()` to optimize performance for PNG generation and heavy image processing without needing node `canvas` installed.
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
  ![Buffer Logo QR Code](examples/10_buffer_logo.png)
424
527
 
425
- 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.
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
+ ![High Quality JPEG QR Code](examples/11_jpg_high_quality.jpg)
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
+ ![JPEG with Logo Blue QR Code](examples/12_jpg_logo_blue.jpg)
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
+ ![Compressed JPEG Green QR Code](examples/13_jpg_compressed_green.jpg)
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
+ ![JPEG Buffer Logo Orange QR Code](examples/14_jpg_buffer_logo_orange.jpg)
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
@@ -3,9 +3,6 @@
3
3
  // @ts-nocheck
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- const { createRequire } = require('node:module')
7
- require = createRequire(__filename)
8
-
9
6
  const { readFileSync } = require('node:fs')
10
7
  let nativeBinding = null
11
8
  const loadErrors = []
@@ -80,8 +77,8 @@ function requireNative() {
80
77
  try {
81
78
  const binding = require('qrbit-android-arm64')
82
79
  const bindingPackageVersion = require('qrbit-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '1.2.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.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
82
  }
86
83
  return binding
87
84
  } catch (e) {
@@ -96,8 +93,8 @@ function requireNative() {
96
93
  try {
97
94
  const binding = require('qrbit-android-arm-eabi')
98
95
  const bindingPackageVersion = require('qrbit-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '1.2.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.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
98
  }
102
99
  return binding
103
100
  } catch (e) {
@@ -108,7 +105,24 @@ function requireNative() {
108
105
  }
109
106
  } else if (process.platform === 'win32') {
110
107
  if (process.arch === 'x64') {
108
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
109
+ try {
110
+ return require('./qrbit.win32-x64-gnu.node')
111
+ } catch (e) {
112
+ loadErrors.push(e)
113
+ }
111
114
  try {
115
+ const binding = require('qrbit-win32-x64-gnu')
116
+ const bindingPackageVersion = require('qrbit-win32-x64-gnu/package.json').version
117
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ }
120
+ return binding
121
+ } catch (e) {
122
+ loadErrors.push(e)
123
+ }
124
+ } else {
125
+ try {
112
126
  return require('./qrbit.win32-x64-msvc.node')
113
127
  } catch (e) {
114
128
  loadErrors.push(e)
@@ -116,13 +130,14 @@ function requireNative() {
116
130
  try {
117
131
  const binding = require('qrbit-win32-x64-msvc')
118
132
  const bindingPackageVersion = require('qrbit-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
135
  }
122
136
  return binding
123
137
  } catch (e) {
124
138
  loadErrors.push(e)
125
139
  }
140
+ }
126
141
  } else if (process.arch === 'ia32') {
127
142
  try {
128
143
  return require('./qrbit.win32-ia32-msvc.node')
@@ -132,8 +147,8 @@ function requireNative() {
132
147
  try {
133
148
  const binding = require('qrbit-win32-ia32-msvc')
134
149
  const bindingPackageVersion = require('qrbit-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
152
  }
138
153
  return binding
139
154
  } catch (e) {
@@ -148,8 +163,8 @@ function requireNative() {
148
163
  try {
149
164
  const binding = require('qrbit-win32-arm64-msvc')
150
165
  const bindingPackageVersion = require('qrbit-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
168
  }
154
169
  return binding
155
170
  } catch (e) {
@@ -167,8 +182,8 @@ function requireNative() {
167
182
  try {
168
183
  const binding = require('qrbit-darwin-universal')
169
184
  const bindingPackageVersion = require('qrbit-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
187
  }
173
188
  return binding
174
189
  } catch (e) {
@@ -183,8 +198,8 @@ function requireNative() {
183
198
  try {
184
199
  const binding = require('qrbit-darwin-x64')
185
200
  const bindingPackageVersion = require('qrbit-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
203
  }
189
204
  return binding
190
205
  } catch (e) {
@@ -199,8 +214,8 @@ function requireNative() {
199
214
  try {
200
215
  const binding = require('qrbit-darwin-arm64')
201
216
  const bindingPackageVersion = require('qrbit-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
219
  }
205
220
  return binding
206
221
  } catch (e) {
@@ -219,8 +234,8 @@ function requireNative() {
219
234
  try {
220
235
  const binding = require('qrbit-freebsd-x64')
221
236
  const bindingPackageVersion = require('qrbit-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
239
  }
225
240
  return binding
226
241
  } catch (e) {
@@ -235,8 +250,8 @@ function requireNative() {
235
250
  try {
236
251
  const binding = require('qrbit-freebsd-arm64')
237
252
  const bindingPackageVersion = require('qrbit-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
255
  }
241
256
  return binding
242
257
  } catch (e) {
@@ -256,8 +271,8 @@ function requireNative() {
256
271
  try {
257
272
  const binding = require('qrbit-linux-x64-musl')
258
273
  const bindingPackageVersion = require('qrbit-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
276
  }
262
277
  return binding
263
278
  } catch (e) {
@@ -272,8 +287,8 @@ function requireNative() {
272
287
  try {
273
288
  const binding = require('qrbit-linux-x64-gnu')
274
289
  const bindingPackageVersion = require('qrbit-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
292
  }
278
293
  return binding
279
294
  } catch (e) {
@@ -290,8 +305,8 @@ function requireNative() {
290
305
  try {
291
306
  const binding = require('qrbit-linux-arm64-musl')
292
307
  const bindingPackageVersion = require('qrbit-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '1.2.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.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
310
  }
296
311
  return binding
297
312
  } catch (e) {
@@ -306,8 +321,8 @@ function requireNative() {
306
321
  try {
307
322
  const binding = require('qrbit-linux-arm64-gnu')
308
323
  const bindingPackageVersion = require('qrbit-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
326
  }
312
327
  return binding
313
328
  } catch (e) {
@@ -324,8 +339,8 @@ function requireNative() {
324
339
  try {
325
340
  const binding = require('qrbit-linux-arm-musleabihf')
326
341
  const bindingPackageVersion = require('qrbit-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '1.2.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.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
344
  }
330
345
  return binding
331
346
  } catch (e) {
@@ -340,8 +355,8 @@ function requireNative() {
340
355
  try {
341
356
  const binding = require('qrbit-linux-arm-gnueabihf')
342
357
  const bindingPackageVersion = require('qrbit-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
360
  }
346
361
  return binding
347
362
  } catch (e) {
@@ -358,8 +373,8 @@ function requireNative() {
358
373
  try {
359
374
  const binding = require('qrbit-linux-loong64-musl')
360
375
  const bindingPackageVersion = require('qrbit-linux-loong64-musl/package.json').version
361
- if (bindingPackageVersion !== '1.2.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.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
378
  }
364
379
  return binding
365
380
  } catch (e) {
@@ -374,8 +389,8 @@ function requireNative() {
374
389
  try {
375
390
  const binding = require('qrbit-linux-loong64-gnu')
376
391
  const bindingPackageVersion = require('qrbit-linux-loong64-gnu/package.json').version
377
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
394
  }
380
395
  return binding
381
396
  } catch (e) {
@@ -392,8 +407,8 @@ function requireNative() {
392
407
  try {
393
408
  const binding = require('qrbit-linux-riscv64-musl')
394
409
  const bindingPackageVersion = require('qrbit-linux-riscv64-musl/package.json').version
395
- if (bindingPackageVersion !== '1.2.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.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
412
  }
398
413
  return binding
399
414
  } catch (e) {
@@ -408,8 +423,8 @@ function requireNative() {
408
423
  try {
409
424
  const binding = require('qrbit-linux-riscv64-gnu')
410
425
  const bindingPackageVersion = require('qrbit-linux-riscv64-gnu/package.json').version
411
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
428
  }
414
429
  return binding
415
430
  } catch (e) {
@@ -425,8 +440,8 @@ function requireNative() {
425
440
  try {
426
441
  const binding = require('qrbit-linux-ppc64-gnu')
427
442
  const bindingPackageVersion = require('qrbit-linux-ppc64-gnu/package.json').version
428
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
429
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
445
  }
431
446
  return binding
432
447
  } catch (e) {
@@ -441,8 +456,8 @@ function requireNative() {
441
456
  try {
442
457
  const binding = require('qrbit-linux-s390x-gnu')
443
458
  const bindingPackageVersion = require('qrbit-linux-s390x-gnu/package.json').version
444
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
445
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
446
461
  }
447
462
  return binding
448
463
  } catch (e) {
@@ -461,8 +476,8 @@ function requireNative() {
461
476
  try {
462
477
  const binding = require('qrbit-openharmony-arm64')
463
478
  const bindingPackageVersion = require('qrbit-openharmony-arm64/package.json').version
464
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
465
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
466
481
  }
467
482
  return binding
468
483
  } catch (e) {
@@ -477,8 +492,8 @@ function requireNative() {
477
492
  try {
478
493
  const binding = require('qrbit-openharmony-x64')
479
494
  const bindingPackageVersion = require('qrbit-openharmony-x64/package.json').version
480
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
481
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
482
497
  }
483
498
  return binding
484
499
  } catch (e) {
@@ -493,8 +508,8 @@ function requireNative() {
493
508
  try {
494
509
  const binding = require('qrbit-openharmony-arm')
495
510
  const bindingPackageVersion = require('qrbit-openharmony-arm/package.json').version
496
- if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
497
- throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
498
513
  }
499
514
  return binding
500
515
  } catch (e) {
@@ -557,9 +572,7 @@ if (!nativeBinding) {
557
572
  }
558
573
 
559
574
  module.exports = nativeBinding
575
+ module.exports.convertSvgToJpeg = nativeBinding.convertSvgToJpeg
560
576
  module.exports.convertSvgToPng = nativeBinding.convertSvgToPng
561
- module.exports.generateQr = nativeBinding.generateQr
562
- module.exports.generateQrPng = nativeBinding.generateQrPng
563
- module.exports.generateQrPngWithBuffer = nativeBinding.generateQrPngWithBuffer
564
577
  module.exports.generateQrSvg = nativeBinding.generateQrSvg
565
578
  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 convertSvgToPng(svgContent: string, width?: number | undefined | null, height?: number | undefined | null): Buffer
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 generateQrPng(options: QrOptions): Buffer
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 convertSvgToPng(svgContent: string, width?: number | undefined | null, height?: number | undefined | null): Buffer
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 generateQrPng(options: QrOptions): Buffer
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