qrbit 1.3.1 → 1.3.2

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/dist/native.cjs CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('qrbit-android-arm64')
79
79
  const bindingPackageVersion = require('qrbit-android-arm64/package.json').version
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.`)
80
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('qrbit-android-arm-eabi')
95
95
  const bindingPackageVersion = require('qrbit-android-arm-eabi/package.json').version
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.`)
96
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('qrbit-win32-x64-gnu')
116
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.`)
117
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('qrbit-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('qrbit-win32-x64-msvc/package.json').version
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.`)
133
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('qrbit-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('qrbit-win32-ia32-msvc/package.json').version
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.`)
150
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('qrbit-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('qrbit-win32-arm64-msvc/package.json').version
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.`)
166
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('qrbit-darwin-universal')
184
184
  const bindingPackageVersion = require('qrbit-darwin-universal/package.json').version
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.`)
185
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('qrbit-darwin-x64')
200
200
  const bindingPackageVersion = require('qrbit-darwin-x64/package.json').version
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.`)
201
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('qrbit-darwin-arm64')
216
216
  const bindingPackageVersion = require('qrbit-darwin-arm64/package.json').version
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.`)
217
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('qrbit-freebsd-x64')
236
236
  const bindingPackageVersion = require('qrbit-freebsd-x64/package.json').version
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.`)
237
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('qrbit-freebsd-arm64')
252
252
  const bindingPackageVersion = require('qrbit-freebsd-arm64/package.json').version
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.`)
253
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('qrbit-linux-x64-musl')
273
273
  const bindingPackageVersion = require('qrbit-linux-x64-musl/package.json').version
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.`)
274
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('qrbit-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('qrbit-linux-x64-gnu/package.json').version
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.`)
290
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('qrbit-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('qrbit-linux-arm64-musl/package.json').version
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.`)
308
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('qrbit-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('qrbit-linux-arm64-gnu/package.json').version
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.`)
324
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('qrbit-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('qrbit-linux-arm-musleabihf/package.json').version
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.`)
342
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('qrbit-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('qrbit-linux-arm-gnueabihf/package.json').version
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.`)
358
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('qrbit-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('qrbit-linux-loong64-musl/package.json').version
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.`)
376
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('qrbit-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('qrbit-linux-loong64-gnu/package.json').version
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.`)
392
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('qrbit-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('qrbit-linux-riscv64-musl/package.json').version
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.`)
410
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('qrbit-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('qrbit-linux-riscv64-gnu/package.json').version
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.`)
426
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('qrbit-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('qrbit-linux-ppc64-gnu/package.json').version
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.`)
443
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('qrbit-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('qrbit-linux-s390x-gnu/package.json').version
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.`)
459
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('qrbit-openharmony-arm64')
478
478
  const bindingPackageVersion = require('qrbit-openharmony-arm64/package.json').version
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.`)
479
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('qrbit-openharmony-x64')
494
494
  const bindingPackageVersion = require('qrbit-openharmony-x64/package.json').version
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.`)
495
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('qrbit-openharmony-arm')
510
510
  const bindingPackageVersion = require('qrbit-openharmony-arm/package.json').version
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.`)
511
+ if (bindingPackageVersion !== '1.3.2' && 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.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
package/dist/native.js CHANGED
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('qrbit-android-arm64')
83
83
  const bindingPackageVersion = require('qrbit-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
86
  }
87
87
  return binding
88
88
  } catch (e) {
@@ -97,8 +97,8 @@ function requireNative() {
97
97
  try {
98
98
  const binding = require('qrbit-android-arm-eabi')
99
99
  const bindingPackageVersion = require('qrbit-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -118,8 +118,8 @@ function requireNative() {
118
118
  try {
119
119
  const binding = require('qrbit-win32-x64-gnu')
120
120
  const bindingPackageVersion = require('qrbit-win32-x64-gnu/package.json').version
121
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
123
123
  }
124
124
  return binding
125
125
  } catch (e) {
@@ -134,8 +134,8 @@ function requireNative() {
134
134
  try {
135
135
  const binding = require('qrbit-win32-x64-msvc')
136
136
  const bindingPackageVersion = require('qrbit-win32-x64-msvc/package.json').version
137
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
139
139
  }
140
140
  return binding
141
141
  } catch (e) {
@@ -151,8 +151,8 @@ function requireNative() {
151
151
  try {
152
152
  const binding = require('qrbit-win32-ia32-msvc')
153
153
  const bindingPackageVersion = require('qrbit-win32-ia32-msvc/package.json').version
154
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
156
156
  }
157
157
  return binding
158
158
  } catch (e) {
@@ -167,8 +167,8 @@ function requireNative() {
167
167
  try {
168
168
  const binding = require('qrbit-win32-arm64-msvc')
169
169
  const bindingPackageVersion = require('qrbit-win32-arm64-msvc/package.json').version
170
- if (bindingPackageVersion !== '1.3.1' && 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.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '1.3.2' && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
172
  }
173
173
  return binding
174
174
  } catch (e) {
@@ -186,8 +186,8 @@ function requireNative() {
186
186
  try {
187
187
  const binding = require('qrbit-darwin-universal')
188
188
  const bindingPackageVersion = require('qrbit-darwin-universal/package.json').version
189
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
191
191
  }
192
192
  return binding
193
193
  } catch (e) {
@@ -202,8 +202,8 @@ function requireNative() {
202
202
  try {
203
203
  const binding = require('qrbit-darwin-x64')
204
204
  const bindingPackageVersion = require('qrbit-darwin-x64/package.json').version
205
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
207
  }
208
208
  return binding
209
209
  } catch (e) {
@@ -218,8 +218,8 @@ function requireNative() {
218
218
  try {
219
219
  const binding = require('qrbit-darwin-arm64')
220
220
  const bindingPackageVersion = require('qrbit-darwin-arm64/package.json').version
221
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
221
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
223
  }
224
224
  return binding
225
225
  } catch (e) {
@@ -238,8 +238,8 @@ function requireNative() {
238
238
  try {
239
239
  const binding = require('qrbit-freebsd-x64')
240
240
  const bindingPackageVersion = require('qrbit-freebsd-x64/package.json').version
241
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
243
243
  }
244
244
  return binding
245
245
  } catch (e) {
@@ -254,8 +254,8 @@ function requireNative() {
254
254
  try {
255
255
  const binding = require('qrbit-freebsd-arm64')
256
256
  const bindingPackageVersion = require('qrbit-freebsd-arm64/package.json').version
257
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
257
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
259
  }
260
260
  return binding
261
261
  } catch (e) {
@@ -275,8 +275,8 @@ function requireNative() {
275
275
  try {
276
276
  const binding = require('qrbit-linux-x64-musl')
277
277
  const bindingPackageVersion = require('qrbit-linux-x64-musl/package.json').version
278
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
280
280
  }
281
281
  return binding
282
282
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('qrbit-linux-x64-gnu')
293
293
  const bindingPackageVersion = require('qrbit-linux-x64-gnu/package.json').version
294
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -309,8 +309,8 @@ function requireNative() {
309
309
  try {
310
310
  const binding = require('qrbit-linux-arm64-musl')
311
311
  const bindingPackageVersion = require('qrbit-linux-arm64-musl/package.json').version
312
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
314
314
  }
315
315
  return binding
316
316
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('qrbit-linux-arm64-gnu')
327
327
  const bindingPackageVersion = require('qrbit-linux-arm64-gnu/package.json').version
328
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -343,8 +343,8 @@ function requireNative() {
343
343
  try {
344
344
  const binding = require('qrbit-linux-arm-musleabihf')
345
345
  const bindingPackageVersion = require('qrbit-linux-arm-musleabihf/package.json').version
346
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
348
348
  }
349
349
  return binding
350
350
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('qrbit-linux-arm-gnueabihf')
361
361
  const bindingPackageVersion = require('qrbit-linux-arm-gnueabihf/package.json').version
362
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -377,8 +377,8 @@ function requireNative() {
377
377
  try {
378
378
  const binding = require('qrbit-linux-loong64-musl')
379
379
  const bindingPackageVersion = require('qrbit-linux-loong64-musl/package.json').version
380
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
382
  }
383
383
  return binding
384
384
  } catch (e) {
@@ -393,8 +393,8 @@ function requireNative() {
393
393
  try {
394
394
  const binding = require('qrbit-linux-loong64-gnu')
395
395
  const bindingPackageVersion = require('qrbit-linux-loong64-gnu/package.json').version
396
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
398
  }
399
399
  return binding
400
400
  } catch (e) {
@@ -411,8 +411,8 @@ function requireNative() {
411
411
  try {
412
412
  const binding = require('qrbit-linux-riscv64-musl')
413
413
  const bindingPackageVersion = require('qrbit-linux-riscv64-musl/package.json').version
414
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
414
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
416
416
  }
417
417
  return binding
418
418
  } catch (e) {
@@ -427,8 +427,8 @@ function requireNative() {
427
427
  try {
428
428
  const binding = require('qrbit-linux-riscv64-gnu')
429
429
  const bindingPackageVersion = require('qrbit-linux-riscv64-gnu/package.json').version
430
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
432
  }
433
433
  return binding
434
434
  } catch (e) {
@@ -444,8 +444,8 @@ function requireNative() {
444
444
  try {
445
445
  const binding = require('qrbit-linux-ppc64-gnu')
446
446
  const bindingPackageVersion = require('qrbit-linux-ppc64-gnu/package.json').version
447
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
449
  }
450
450
  return binding
451
451
  } catch (e) {
@@ -460,8 +460,8 @@ function requireNative() {
460
460
  try {
461
461
  const binding = require('qrbit-linux-s390x-gnu')
462
462
  const bindingPackageVersion = require('qrbit-linux-s390x-gnu/package.json').version
463
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
465
  }
466
466
  return binding
467
467
  } catch (e) {
@@ -480,8 +480,8 @@ function requireNative() {
480
480
  try {
481
481
  const binding = require('qrbit-openharmony-arm64')
482
482
  const bindingPackageVersion = require('qrbit-openharmony-arm64/package.json').version
483
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
483
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
485
485
  }
486
486
  return binding
487
487
  } catch (e) {
@@ -496,8 +496,8 @@ function requireNative() {
496
496
  try {
497
497
  const binding = require('qrbit-openharmony-x64')
498
498
  const bindingPackageVersion = require('qrbit-openharmony-x64/package.json').version
499
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
499
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
501
  }
502
502
  return binding
503
503
  } catch (e) {
@@ -512,8 +512,8 @@ function requireNative() {
512
512
  try {
513
513
  const binding = require('qrbit-openharmony-arm')
514
514
  const bindingPackageVersion = require('qrbit-openharmony-arm/package.json').version
515
- if (bindingPackageVersion !== '1.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
- throw new Error(`Native binding package version mismatch, expected 1.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
515
+ if (bindingPackageVersion !== '1.3.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
+ throw new Error(`Native binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
517
517
  }
518
518
  return binding
519
519
  } catch (e) {
package/dist/qrbit.cjs CHANGED
@@ -218,7 +218,7 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
218
218
  foregroundColor: this._foregroundColor
219
219
  };
220
220
  if (this._cache && options?.cache !== false) {
221
- const key = this.generateCacheKey(renderKey);
221
+ const key = await this.generateCacheKey(renderKey);
222
222
  const cached = await this._cache.get(key);
223
223
  if (cached) {
224
224
  return cached;
@@ -238,7 +238,7 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
238
238
  result = await this.toSvgNapi();
239
239
  }
240
240
  if (this._cache && options?.cache !== false) {
241
- const key = this.generateCacheKey(renderKey);
241
+ const key = await this.generateCacheKey(renderKey);
242
242
  await this._cache.set(key, result);
243
243
  }
244
244
  return result;
@@ -292,7 +292,7 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
292
292
  let result;
293
293
  const renderKey = `napi-png`;
294
294
  if (this._cache && options?.cache !== false) {
295
- const key = this.generateCacheKey(renderKey);
295
+ const key = await this.generateCacheKey(renderKey);
296
296
  const cached = await this._cache.get(key);
297
297
  if (cached) {
298
298
  return import_node_buffer.Buffer.from(cached);
@@ -301,7 +301,7 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
301
301
  const svg = await this.toSvg();
302
302
  result = _QrBit.convertSvgToPng(svg);
303
303
  if (this._cache && options?.cache !== false) {
304
- const key = this.generateCacheKey(renderKey);
304
+ const key = await this.generateCacheKey(renderKey);
305
305
  await this._cache.set(key, result);
306
306
  }
307
307
  return result;
@@ -333,7 +333,7 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
333
333
  const quality = options?.quality ?? 90;
334
334
  const renderKey = `napi-jpeg-${quality}`;
335
335
  if (this._cache && options?.cache !== false) {
336
- const key = this.generateCacheKey(renderKey);
336
+ const key = await this.generateCacheKey(renderKey);
337
337
  const cached = await this._cache.get(key);
338
338
  if (cached) {
339
339
  return import_node_buffer.Buffer.from(cached);
@@ -342,7 +342,7 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
342
342
  const svg = await this.toSvg();
343
343
  result = _QrBit.convertSvgToJpeg(svg, void 0, void 0, quality);
344
344
  if (this._cache && options?.cache !== false) {
345
- const key = this.generateCacheKey(renderKey);
345
+ const key = await this.generateCacheKey(renderKey);
346
346
  await this._cache.set(key, result);
347
347
  }
348
348
  return result;
@@ -400,9 +400,9 @@ var QrBit = class _QrBit extends import_hookified.Hookified {
400
400
  /**
401
401
  * Generate a cache key based on the current QR code options.
402
402
  * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`
403
- * @returns {string} The cache key
403
+ * @returns {Promise<string>} The cache key
404
404
  */
405
- generateCacheKey(renderKey) {
405
+ async generateCacheKey(renderKey) {
406
406
  const qrOptions = {
407
407
  text: this._text,
408
408
  size: this._size,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/qrbit.ts"],"sourcesContent":["import { Buffer } from \"node:buffer\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Cacheable } from \"cacheable\";\nimport { Hookified, type HookifiedOptions } from \"hookified\";\nimport QRCode, { type QRCodeToStringOptions } from \"qrcode\";\nimport {\n\tconvertSvgToJpeg as nativeConvertSvgToJpeg,\n\tconvertSvgToPng as nativeConvertSvgToPng,\n\tgenerateQrSvg as nativeGenerateQrSvg,\n\tgenerateQrSvgWithBuffer as nativeGenerateQrSvgWithBuffer,\n} from \"./native.js\";\n\nexport enum QrBitEvents {\n\twarn = \"warn\",\n\tinfo = \"info\",\n\terror = \"error\",\n}\n\nconst logoFileDoesNotExistMessage = (logo: string) =>\n\t`Logo file not found: ${logo}. Proceeding without logo.`;\n\nexport type QrOptions = {\n\t/**\n\t * The text content to encode in the QR code. It can be text or a url.\n\t * @type {string}\n\t */\n\ttext: string;\n\t/**\n\t * The size of the QR code in pixels.\n\t * @type {number}\n\t * @default 200\n\t */\n\tsize?: number;\n\t/**\n\t * The margin around the QR code in pixels.\n\t * @type {number}\n\t */\n\tmargin?: number;\n\t/**\n\t * The logo to embed in the QR code.\n\t * @type {string | Buffer}\n\t */\n\tlogo?: string | Buffer;\n\t/**\n\t * The logo size ratio relative to QR code size.\n\t * @type {number}\n\t * @default 0.2\n\t */\n\tlogoSizeRatio?: number;\n\t/**\n\t * The background color of the QR code.\n\t * @type {string}\n\t * @default \"#FFFFFF\"\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The foreground color of the QR code.\n\t * @type {string}\n\t * @default \"#000000\"\n\t */\n\tforegroundColor?: string;\n\t/**\n\t * Caching is enabled by default. You can disable it by setting this option to false. You can also pass\n\t * a custom Cacheable instance.\n\t * @type {Cacheable | boolean}\n\t * @default true\n\t */\n\tcache?: Cacheable | boolean;\n} & HookifiedOptions;\n\nexport interface QrResult {\n\tsvg?: string;\n\tpng?: Buffer;\n\twidth: number;\n\theight: number;\n}\n\nexport type toOptions = {\n\tcache?: boolean;\n\tquality?: number;\n};\n\n/**\n * QR code generator with logo support and caching capabilities.\n * Supports both file path and buffer-based logos with automatic optimization.\n */\nexport class QrBit extends Hookified {\n\tprivate _text: string;\n\tprivate _size: number;\n\tprivate _margin: number | undefined;\n\tprivate _logo: string | Buffer | undefined;\n\tprivate _logoSizeRatio: number;\n\tprivate _backgroundColor: string;\n\tprivate _foregroundColor: string;\n\tprivate _cache: Cacheable | undefined;\n\tprivate _napi = {\n\t\tconvertSvgToJpeg: nativeConvertSvgToJpeg,\n\t\tconvertSvgToPng: nativeConvertSvgToPng,\n\t\tgenerateQrSvg: nativeGenerateQrSvg,\n\t\tgenerateQrSvgWithBuffer: nativeGenerateQrSvgWithBuffer,\n\t};\n\n\t/**\n\t * Create a new QrBit instance.\n\t * @param options - Configuration options for the QR code\n\t */\n\tconstructor(options: QrOptions) {\n\t\tsuper();\n\t\tthis._text = options.text;\n\t\tthis._size = options.size ?? 200;\n\t\tthis._margin = options.margin ?? undefined;\n\t\tthis._logo = options.logo;\n\t\tthis._logoSizeRatio = options.logoSizeRatio ?? 0.2;\n\t\tthis._backgroundColor = options.backgroundColor ?? \"#FFFFFF\";\n\t\tthis._foregroundColor = options.foregroundColor ?? \"#000000\";\n\t\tif (options.cache !== undefined) {\n\t\t\t// if it is boolean and true then create a new cacheable instance\n\t\t\tif (options.cache === true) {\n\t\t\t\tthis._cache = new Cacheable();\n\t\t\t} else if (options.cache !== false) {\n\t\t\t\t// it is a cacheable instance\n\t\t\t\tthis._cache = options.cache as Cacheable;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._cache = new Cacheable();\n\t\t}\n\n\t\t// set throwOnEmitError to true if there are no listeners\n\t\tthis.throwOnEmitError = true;\n\t}\n\n\t/**\n\t * Get the text content for the QR code.\n\t * @returns {string} The text content\n\t */\n\tpublic get text(): string {\n\t\treturn this._text;\n\t}\n\n\t/**\n\t * Set the text content for the QR code.\n\t * @param value - The text content to encode\n\t */\n\tpublic set text(value: string) {\n\t\tthis._text = value;\n\t}\n\n\t/**\n\t * Get the size of the QR code in pixels.\n\t * @returns {number} The size in pixels\n\t * @default 200\n\t */\n\tpublic get size(): number {\n\t\treturn this._size;\n\t}\n\n\t/**\n\t * Set the size of the QR code in pixels.\n\t * @param value - The size in pixels\n\t */\n\tpublic set size(value: number) {\n\t\tthis._size = value;\n\t}\n\n\t/**\n\t * Get the margin around the QR code in pixels.\n\t * @returns {number | undefined} The margin in pixels\n\t */\n\tpublic get margin(): number | undefined {\n\t\treturn this._margin;\n\t}\n\n\t/**\n\t * Set the margin around the QR code in pixels.\n\t * @param value - The margin in pixels\n\t */\n\tpublic set margin(value: number | undefined) {\n\t\tthis._margin = value;\n\t}\n\n\t/**\n\t * Get the logo path or buffer.\n\t * @returns {string | Buffer | undefined} The logo path, buffer, or undefined if no logo\n\t * @default undefined\n\t */\n\tpublic get logo(): string | Buffer | undefined {\n\t\treturn this._logo;\n\t}\n\n\t/**\n\t * Set the logo as a file path or buffer.\n\t * @param value - The logo file path, buffer, or undefined to remove logo\n\t */\n\tpublic set logo(value: string | Buffer | undefined) {\n\t\tthis._logo = value;\n\t}\n\n\t/**\n\t * Get the logo size ratio relative to QR code size.\n\t * @returns {number} The logo size ratio\n\t * @default 0.2\n\t */\n\tpublic get logoSizeRatio(): number {\n\t\treturn this._logoSizeRatio;\n\t}\n\n\t/**\n\t * Set the logo size ratio relative to QR code size.\n\t * @param value - The logo size ratio (0.0 to 1.0)\n\t */\n\tpublic set logoSizeRatio(value: number) {\n\t\tthis._logoSizeRatio = value;\n\t}\n\n\t/**\n\t * Get the background color of the QR code.\n\t * @returns {string} The background color in hex format\n\t * @default \"#FFFFFF\"\n\t */\n\tpublic get backgroundColor(): string {\n\t\treturn this._backgroundColor;\n\t}\n\n\t/**\n\t * Set the background color of the QR code.\n\t * @param value - The background color in hex format (e.g., \"#FFFFFF\")\n\t */\n\tpublic set backgroundColor(value: string) {\n\t\tthis._backgroundColor = value;\n\t}\n\n\t/**\n\t * Get the foreground color of the QR code.\n\t * @returns {string} The foreground color in hex format\n\t * @default \"#000000\"\n\t */\n\tpublic get foregroundColor(): string {\n\t\treturn this._foregroundColor;\n\t}\n\n\t/**\n\t * Set the foreground color of the QR code.\n\t * @param value - The foreground color in hex format (e.g., \"#000000\")\n\t */\n\tpublic set foregroundColor(value: string) {\n\t\tthis._foregroundColor = value;\n\t}\n\n\t/**\n\t * Get the cache instance.\n\t * @returns {Cacheable | undefined} The cache instance or undefined if caching is disabled\n\t */\n\tpublic get cache(): Cacheable | undefined {\n\t\treturn this._cache;\n\t}\n\n\t/**\n\t * Set the cache instance.\n\t * @param value - The cache instance or undefined to disable caching\n\t */\n\tpublic set cache(value: Cacheable | undefined) {\n\t\tthis._cache = value;\n\t}\n\n\t/**\n\t * Generate SVG QR code with optional caching.\n\t * Uses QRCode library for simple cases, Rust implementation for logos.\n\t * @param {toOptions} options - Generation options whether to use caching (default: true)\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvg(options?: toOptions): Promise<string> {\n\t\tlet result = \"\";\n\t\tlet renderKey = `native-svg`;\n\n\t\tif (this._logo) {\n\t\t\trenderKey = `napi-svg`;\n\t\t}\n\n\t\t// set all the options\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t};\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<string>(key);\n\t\t\tif (cached) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t}\n\n\t\tif (!this._logo) {\n\t\t\tconst qrCodeOptions: QRCodeToStringOptions = {\n\t\t\t\ttype: \"svg\",\n\t\t\t\twidth: qrOptions.size,\n\t\t\t\tcolor: {\n\t\t\t\t\tdark: qrOptions.foregroundColor,\n\t\t\t\t\tlight: qrOptions.backgroundColor,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tresult = await QRCode.toString(this._text, qrCodeOptions);\n\t\t} else {\n\t\t\t// If logoPath is set, use the Rust implementation\n\t\t\tresult = await this.toSvgNapi();\n\t\t}\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate SVG QR code using the native Rust implementation.\n\t * Automatically chooses between file path and buffer functions.\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvgNapi(): Promise<string> {\n\t\t// Choose optimal path based on logo type\n\t\tif (this._logo && Buffer.isBuffer(this._logo)) {\n\t\t\t// Logo is already a buffer - use buffer function\n\t\t\tconst nativeOptionsBuffer = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoBuffer: this._logo,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\t\t\treturn this._napi.generateQrSvgWithBuffer(nativeOptionsBuffer);\n\t\t} else {\n\t\t\t// Logo is a string path or undefined - use original function\n\t\t\tconst nativeOptions = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoPath: this._logo as string,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\n\t\t\tif (this._logo && this.isLogoString()) {\n\t\t\t\tif (!(await this.logoFileExists(this._logo as string))) {\n\t\t\t\t\tthis.emit(\n\t\t\t\t\t\tQrBitEvents.error,\n\t\t\t\t\t\tlogoFileDoesNotExistMessage(this._logo as string),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this._napi.generateQrSvg(nativeOptions);\n\t\t}\n\t}\n\n\t/**\n\t * Generate PNG QR code with optional caching.\n\t * Generates the QR as Svg either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<Buffer>} The PNG buffer\n\t */\n\tpublic async toPng(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst renderKey = `napi-png`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToPng(svg);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate PNG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the PNG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toPngFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst pngBuffer = await this.toPng(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, pngBuffer);\n\t}\n\n\t/**\n\t * Generate JPEG QR code with optional caching.\n\t * Generates the QR as SVG either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<Buffer>} The JPEG buffer\n\t */\n\tpublic async toJpg(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst quality = options?.quality ?? 90;\n\t\tconst renderKey = `napi-jpeg-${quality}`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToJpeg(svg, undefined, undefined, quality);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate JPEG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the JPEG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toJpgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst jpegBuffer = await this.toJpg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, jpegBuffer);\n\t}\n\n\t/**\n\t * Generate SVG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the SVG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toSvgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst svgString = await this.toSvg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, svgString, \"utf8\");\n\t}\n\n\t/**\n\t * Convert SVG content to PNG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the PNG output\n\t * @param height - Optional height for the PNG output\n\t * @returns {Buffer} The PNG buffer\n\t */\n\tpublic static convertSvgToPng(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToPng(svgContent, width, height);\n\t}\n\n\t/**\n\t * Convert SVG content to JPEG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the JPEG output\n\t * @param height - Optional height for the JPEG output\n\t * @param quality - Optional JPEG quality 1-100 (default: 90)\n\t * @returns {Buffer} The JPEG buffer\n\t */\n\tpublic static convertSvgToJpeg(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t\tquality?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToJpeg(svgContent, width, height, quality);\n\t}\n\n\t/**\n\t * Generate a cache key based on the current QR code options.\n\t * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`\n\t * @returns {string} The cache key\n\t */\n\tpublic generateCacheKey(renderKey: string): string {\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo || undefined,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t\trenderKey,\n\t\t};\n\n\t\tconst cache = this._cache || new Cacheable();\n\n\t\treturn cache.hash(qrOptions);\n\t}\n\n\t/**\n\t * Check if the logo is a string (file path).\n\t * @returns {boolean} True if logo is a string, false otherwise\n\t */\n\tpublic isLogoString(): boolean {\n\t\treturn typeof this._logo === \"string\";\n\t}\n\n\t/**\n\t * Check if a logo file exists at the specified path.\n\t * @param filePath - The file path to check\n\t * @returns {Promise<boolean>} True if file exists, false otherwise\n\t */\n\tpublic async logoFileExists(filePath: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.promises.access(filePath, fs.constants.F_OK);\n\t\t\treturn true;\n\t\t} catch (_error) {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAuB;AACvB,qBAAe;AACf,uBAAiB;A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,UAAM,eAAAA,QAAG,SAAS,UAAU,UAAU,WAAW,MAAM;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAc,gBACb,YACA,OACA,QACS;AACT,eAAO,cAAAL,iBAAsB,YAAY,OAAO,MAAM;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAc,iBACb,YACA,OACA,QACA,SACS;AACT,eAAO,cAAAD,kBAAuB,YAAY,OAAO,QAAQ,OAAO;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,iBAAiB,WAA2B;AAClD,UAAM,YAAY;AAAA,MACjB,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK,SAAS;AAAA,MACpB,eAAe,KAAK;AAAA,MACpB,iBAAiB,KAAK;AAAA,MACtB,iBAAiB,KAAK;AAAA,MACtB;AAAA,IACD;AAEA,UAAM,QAAQ,KAAK,UAAU,IAAI,2BAAU;AAE3C,WAAO,MAAM,KAAK,SAAS;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,eAAwB;AAC9B,WAAO,OAAO,KAAK,UAAU;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,eAAe,UAAoC;AAC/D,QAAI;AACH,YAAM,eAAAM,QAAG,SAAS,OAAO,UAAU,eAAAA,QAAG,UAAU,IAAI;AACpD,aAAO;AAAA,IACR,SAAS,QAAQ;AAChB,aAAO;AAAA,IACR;AAAA,EACD;AACD;","names":["QrBitEvents","nativeConvertSvgToJpeg","nativeConvertSvgToPng","nativeGenerateQrSvg","nativeGenerateQrSvgWithBuffer","QRCode","path","fs"]}
1
+ {"version":3,"sources":["../src/qrbit.ts"],"sourcesContent":["import { Buffer } from \"node:buffer\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Cacheable } from \"cacheable\";\nimport { Hookified, type HookifiedOptions } from \"hookified\";\nimport QRCode, { type QRCodeToStringOptions } from \"qrcode\";\nimport {\n\tconvertSvgToJpeg as nativeConvertSvgToJpeg,\n\tconvertSvgToPng as nativeConvertSvgToPng,\n\tgenerateQrSvg as nativeGenerateQrSvg,\n\tgenerateQrSvgWithBuffer as nativeGenerateQrSvgWithBuffer,\n} from \"./native.js\";\n\nexport enum QrBitEvents {\n\twarn = \"warn\",\n\tinfo = \"info\",\n\terror = \"error\",\n}\n\nconst logoFileDoesNotExistMessage = (logo: string) =>\n\t`Logo file not found: ${logo}. Proceeding without logo.`;\n\nexport type QrOptions = {\n\t/**\n\t * The text content to encode in the QR code. It can be text or a url.\n\t * @type {string}\n\t */\n\ttext: string;\n\t/**\n\t * The size of the QR code in pixels.\n\t * @type {number}\n\t * @default 200\n\t */\n\tsize?: number;\n\t/**\n\t * The margin around the QR code in pixels.\n\t * @type {number}\n\t */\n\tmargin?: number;\n\t/**\n\t * The logo to embed in the QR code.\n\t * @type {string | Buffer}\n\t */\n\tlogo?: string | Buffer;\n\t/**\n\t * The logo size ratio relative to QR code size.\n\t * @type {number}\n\t * @default 0.2\n\t */\n\tlogoSizeRatio?: number;\n\t/**\n\t * The background color of the QR code.\n\t * @type {string}\n\t * @default \"#FFFFFF\"\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The foreground color of the QR code.\n\t * @type {string}\n\t * @default \"#000000\"\n\t */\n\tforegroundColor?: string;\n\t/**\n\t * Caching is enabled by default. You can disable it by setting this option to false. You can also pass\n\t * a custom Cacheable instance.\n\t * @type {Cacheable | boolean}\n\t * @default true\n\t */\n\tcache?: Cacheable | boolean;\n} & HookifiedOptions;\n\nexport interface QrResult {\n\tsvg?: string;\n\tpng?: Buffer;\n\twidth: number;\n\theight: number;\n}\n\nexport type toOptions = {\n\tcache?: boolean;\n\tquality?: number;\n};\n\n/**\n * QR code generator with logo support and caching capabilities.\n * Supports both file path and buffer-based logos with automatic optimization.\n */\nexport class QrBit extends Hookified {\n\tprivate _text: string;\n\tprivate _size: number;\n\tprivate _margin: number | undefined;\n\tprivate _logo: string | Buffer | undefined;\n\tprivate _logoSizeRatio: number;\n\tprivate _backgroundColor: string;\n\tprivate _foregroundColor: string;\n\tprivate _cache: Cacheable | undefined;\n\tprivate _napi = {\n\t\tconvertSvgToJpeg: nativeConvertSvgToJpeg,\n\t\tconvertSvgToPng: nativeConvertSvgToPng,\n\t\tgenerateQrSvg: nativeGenerateQrSvg,\n\t\tgenerateQrSvgWithBuffer: nativeGenerateQrSvgWithBuffer,\n\t};\n\n\t/**\n\t * Create a new QrBit instance.\n\t * @param options - Configuration options for the QR code\n\t */\n\tconstructor(options: QrOptions) {\n\t\tsuper();\n\t\tthis._text = options.text;\n\t\tthis._size = options.size ?? 200;\n\t\tthis._margin = options.margin ?? undefined;\n\t\tthis._logo = options.logo;\n\t\tthis._logoSizeRatio = options.logoSizeRatio ?? 0.2;\n\t\tthis._backgroundColor = options.backgroundColor ?? \"#FFFFFF\";\n\t\tthis._foregroundColor = options.foregroundColor ?? \"#000000\";\n\t\tif (options.cache !== undefined) {\n\t\t\t// if it is boolean and true then create a new cacheable instance\n\t\t\tif (options.cache === true) {\n\t\t\t\tthis._cache = new Cacheable();\n\t\t\t} else if (options.cache !== false) {\n\t\t\t\t// it is a cacheable instance\n\t\t\t\tthis._cache = options.cache as Cacheable;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._cache = new Cacheable();\n\t\t}\n\n\t\t// set throwOnEmitError to true if there are no listeners\n\t\tthis.throwOnEmitError = true;\n\t}\n\n\t/**\n\t * Get the text content for the QR code.\n\t * @returns {string} The text content\n\t */\n\tpublic get text(): string {\n\t\treturn this._text;\n\t}\n\n\t/**\n\t * Set the text content for the QR code.\n\t * @param value - The text content to encode\n\t */\n\tpublic set text(value: string) {\n\t\tthis._text = value;\n\t}\n\n\t/**\n\t * Get the size of the QR code in pixels.\n\t * @returns {number} The size in pixels\n\t * @default 200\n\t */\n\tpublic get size(): number {\n\t\treturn this._size;\n\t}\n\n\t/**\n\t * Set the size of the QR code in pixels.\n\t * @param value - The size in pixels\n\t */\n\tpublic set size(value: number) {\n\t\tthis._size = value;\n\t}\n\n\t/**\n\t * Get the margin around the QR code in pixels.\n\t * @returns {number | undefined} The margin in pixels\n\t */\n\tpublic get margin(): number | undefined {\n\t\treturn this._margin;\n\t}\n\n\t/**\n\t * Set the margin around the QR code in pixels.\n\t * @param value - The margin in pixels\n\t */\n\tpublic set margin(value: number | undefined) {\n\t\tthis._margin = value;\n\t}\n\n\t/**\n\t * Get the logo path or buffer.\n\t * @returns {string | Buffer | undefined} The logo path, buffer, or undefined if no logo\n\t * @default undefined\n\t */\n\tpublic get logo(): string | Buffer | undefined {\n\t\treturn this._logo;\n\t}\n\n\t/**\n\t * Set the logo as a file path or buffer.\n\t * @param value - The logo file path, buffer, or undefined to remove logo\n\t */\n\tpublic set logo(value: string | Buffer | undefined) {\n\t\tthis._logo = value;\n\t}\n\n\t/**\n\t * Get the logo size ratio relative to QR code size.\n\t * @returns {number} The logo size ratio\n\t * @default 0.2\n\t */\n\tpublic get logoSizeRatio(): number {\n\t\treturn this._logoSizeRatio;\n\t}\n\n\t/**\n\t * Set the logo size ratio relative to QR code size.\n\t * @param value - The logo size ratio (0.0 to 1.0)\n\t */\n\tpublic set logoSizeRatio(value: number) {\n\t\tthis._logoSizeRatio = value;\n\t}\n\n\t/**\n\t * Get the background color of the QR code.\n\t * @returns {string} The background color in hex format\n\t * @default \"#FFFFFF\"\n\t */\n\tpublic get backgroundColor(): string {\n\t\treturn this._backgroundColor;\n\t}\n\n\t/**\n\t * Set the background color of the QR code.\n\t * @param value - The background color in hex format (e.g., \"#FFFFFF\")\n\t */\n\tpublic set backgroundColor(value: string) {\n\t\tthis._backgroundColor = value;\n\t}\n\n\t/**\n\t * Get the foreground color of the QR code.\n\t * @returns {string} The foreground color in hex format\n\t * @default \"#000000\"\n\t */\n\tpublic get foregroundColor(): string {\n\t\treturn this._foregroundColor;\n\t}\n\n\t/**\n\t * Set the foreground color of the QR code.\n\t * @param value - The foreground color in hex format (e.g., \"#000000\")\n\t */\n\tpublic set foregroundColor(value: string) {\n\t\tthis._foregroundColor = value;\n\t}\n\n\t/**\n\t * Get the cache instance.\n\t * @returns {Cacheable | undefined} The cache instance or undefined if caching is disabled\n\t */\n\tpublic get cache(): Cacheable | undefined {\n\t\treturn this._cache;\n\t}\n\n\t/**\n\t * Set the cache instance.\n\t * @param value - The cache instance or undefined to disable caching\n\t */\n\tpublic set cache(value: Cacheable | undefined) {\n\t\tthis._cache = value;\n\t}\n\n\t/**\n\t * Generate SVG QR code with optional caching.\n\t * Uses QRCode library for simple cases, Rust implementation for logos.\n\t * @param {toOptions} options - Generation options whether to use caching (default: true)\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvg(options?: toOptions): Promise<string> {\n\t\tlet result = \"\";\n\t\tlet renderKey = `native-svg`;\n\n\t\tif (this._logo) {\n\t\t\trenderKey = `napi-svg`;\n\t\t}\n\n\t\t// set all the options\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t};\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<string>(key);\n\t\t\tif (cached) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t}\n\n\t\tif (!this._logo) {\n\t\t\tconst qrCodeOptions: QRCodeToStringOptions = {\n\t\t\t\ttype: \"svg\",\n\t\t\t\twidth: qrOptions.size,\n\t\t\t\tcolor: {\n\t\t\t\t\tdark: qrOptions.foregroundColor,\n\t\t\t\t\tlight: qrOptions.backgroundColor,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tresult = await QRCode.toString(this._text, qrCodeOptions);\n\t\t} else {\n\t\t\t// If logoPath is set, use the Rust implementation\n\t\t\tresult = await this.toSvgNapi();\n\t\t}\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate SVG QR code using the native Rust implementation.\n\t * Automatically chooses between file path and buffer functions.\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvgNapi(): Promise<string> {\n\t\t// Choose optimal path based on logo type\n\t\tif (this._logo && Buffer.isBuffer(this._logo)) {\n\t\t\t// Logo is already a buffer - use buffer function\n\t\t\tconst nativeOptionsBuffer = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoBuffer: this._logo,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\t\t\treturn this._napi.generateQrSvgWithBuffer(nativeOptionsBuffer);\n\t\t} else {\n\t\t\t// Logo is a string path or undefined - use original function\n\t\t\tconst nativeOptions = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoPath: this._logo as string,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\n\t\t\tif (this._logo && this.isLogoString()) {\n\t\t\t\tif (!(await this.logoFileExists(this._logo as string))) {\n\t\t\t\t\tthis.emit(\n\t\t\t\t\t\tQrBitEvents.error,\n\t\t\t\t\t\tlogoFileDoesNotExistMessage(this._logo as string),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this._napi.generateQrSvg(nativeOptions);\n\t\t}\n\t}\n\n\t/**\n\t * Generate PNG QR code with optional caching.\n\t * Generates the QR as Svg either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<Buffer>} The PNG buffer\n\t */\n\tpublic async toPng(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst renderKey = `napi-png`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToPng(svg);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate PNG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the PNG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toPngFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst pngBuffer = await this.toPng(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, pngBuffer);\n\t}\n\n\t/**\n\t * Generate JPEG QR code with optional caching.\n\t * Generates the QR as SVG either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<Buffer>} The JPEG buffer\n\t */\n\tpublic async toJpg(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst quality = options?.quality ?? 90;\n\t\tconst renderKey = `napi-jpeg-${quality}`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToJpeg(svg, undefined, undefined, quality);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate JPEG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the JPEG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toJpgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst jpegBuffer = await this.toJpg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, jpegBuffer);\n\t}\n\n\t/**\n\t * Generate SVG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the SVG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toSvgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst svgString = await this.toSvg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, svgString, \"utf8\");\n\t}\n\n\t/**\n\t * Convert SVG content to PNG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the PNG output\n\t * @param height - Optional height for the PNG output\n\t * @returns {Buffer} The PNG buffer\n\t */\n\tpublic static convertSvgToPng(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToPng(svgContent, width, height);\n\t}\n\n\t/**\n\t * Convert SVG content to JPEG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the JPEG output\n\t * @param height - Optional height for the JPEG output\n\t * @param quality - Optional JPEG quality 1-100 (default: 90)\n\t * @returns {Buffer} The JPEG buffer\n\t */\n\tpublic static convertSvgToJpeg(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t\tquality?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToJpeg(svgContent, width, height, quality);\n\t}\n\n\t/**\n\t * Generate a cache key based on the current QR code options.\n\t * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`\n\t * @returns {Promise<string>} The cache key\n\t */\n\tpublic async generateCacheKey(renderKey: string): Promise<string> {\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo || undefined,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t\trenderKey,\n\t\t};\n\n\t\tconst cache = this._cache || new Cacheable();\n\n\t\treturn cache.hash(qrOptions);\n\t}\n\n\t/**\n\t * Check if the logo is a string (file path).\n\t * @returns {boolean} True if logo is a string, false otherwise\n\t */\n\tpublic isLogoString(): boolean {\n\t\treturn typeof this._logo === \"string\";\n\t}\n\n\t/**\n\t * Check if a logo file exists at the specified path.\n\t * @param filePath - The file path to check\n\t * @returns {Promise<boolean>} True if file exists, false otherwise\n\t */\n\tpublic async logoFileExists(filePath: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.promises.access(filePath, fs.constants.F_OK);\n\t\t\treturn true;\n\t\t} catch (_error) {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAuB;AACvB,qBAAe;AACf,uBAAiB;AACjB,uBAA0B;AAC1B,uBAAiD;AACjD,oBAAmD;AACnD,oBAKO;AAEA,IAAK,cAAL,kBAAKA,iBAAL;AACN,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,WAAQ;AAHG,SAAAA;AAAA,GAAA;AAMZ,IAAM,8BAA8B,CAAC,SACpC,wBAAwB,IAAI;AAmEtB,IAAM,QAAN,MAAM,eAAc,2BAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBpC,YAAY,SAAoB;AAC/B,UAAM;AAZP,SAAQ,QAAQ;AAAA,MACf,kBAAkB,cAAAC;AAAA,MAClB,iBAAiB,cAAAC;AAAA,MACjB,eAAe,cAAAC;AAAA,MACf,yBAAyB,cAAAC;AAAA,IAC1B;AAQC,SAAK,QAAQ,QAAQ;AACrB,SAAK,QAAQ,QAAQ,QAAQ;AAC7B,SAAK,UAAU,QAAQ,UAAU;AACjC,SAAK,QAAQ,QAAQ;AACrB,SAAK,iBAAiB,QAAQ,iBAAiB;AAC/C,SAAK,mBAAmB,QAAQ,mBAAmB;AACnD,SAAK,mBAAmB,QAAQ,mBAAmB;AACnD,QAAI,QAAQ,UAAU,QAAW;AAEhC,UAAI,QAAQ,UAAU,MAAM;AAC3B,aAAK,S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AMO,eAAwB;AAC9B,WAAO,OAAO,KAAK,UAAU;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,eAAe,UAAoC;AAC/D,QAAI;AACH,YAAM,eAAAM,QAAG,SAAS,OAAO,UAAU,eAAAA,QAAG,UAAU,IAAI;AACpD,aAAO;AAAA,IACR,SAAS,QAAQ;AAChB,aAAO;AAAA,IACR;AAAA,EACD;AACD;","names":["QrBitEvents","nativeConvertSvgToJpeg","nativeConvertSvgToPng","nativeGenerateQrSvg","nativeGenerateQrSvgWithBuffer","QRCode","path","fs"]}
package/dist/qrbit.d.cts CHANGED
@@ -247,9 +247,9 @@ declare class QrBit extends Hookified {
247
247
  /**
248
248
  * Generate a cache key based on the current QR code options.
249
249
  * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`
250
- * @returns {string} The cache key
250
+ * @returns {Promise<string>} The cache key
251
251
  */
252
- generateCacheKey(renderKey: string): string;
252
+ generateCacheKey(renderKey: string): Promise<string>;
253
253
  /**
254
254
  * Check if the logo is a string (file path).
255
255
  * @returns {boolean} True if logo is a string, false otherwise
package/dist/qrbit.d.ts CHANGED
@@ -247,9 +247,9 @@ declare class QrBit extends Hookified {
247
247
  /**
248
248
  * Generate a cache key based on the current QR code options.
249
249
  * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`
250
- * @returns {string} The cache key
250
+ * @returns {Promise<string>} The cache key
251
251
  */
252
- generateCacheKey(renderKey: string): string;
252
+ generateCacheKey(renderKey: string): Promise<string>;
253
253
  /**
254
254
  * Check if the logo is a string (file path).
255
255
  * @returns {boolean} True if logo is a string, false otherwise
Binary file
Binary file
package/dist/qrbit.js CHANGED
@@ -188,7 +188,7 @@ var QrBit = class _QrBit extends Hookified {
188
188
  foregroundColor: this._foregroundColor
189
189
  };
190
190
  if (this._cache && options?.cache !== false) {
191
- const key = this.generateCacheKey(renderKey);
191
+ const key = await this.generateCacheKey(renderKey);
192
192
  const cached = await this._cache.get(key);
193
193
  if (cached) {
194
194
  return cached;
@@ -208,7 +208,7 @@ var QrBit = class _QrBit extends Hookified {
208
208
  result = await this.toSvgNapi();
209
209
  }
210
210
  if (this._cache && options?.cache !== false) {
211
- const key = this.generateCacheKey(renderKey);
211
+ const key = await this.generateCacheKey(renderKey);
212
212
  await this._cache.set(key, result);
213
213
  }
214
214
  return result;
@@ -262,7 +262,7 @@ var QrBit = class _QrBit extends Hookified {
262
262
  let result;
263
263
  const renderKey = `napi-png`;
264
264
  if (this._cache && options?.cache !== false) {
265
- const key = this.generateCacheKey(renderKey);
265
+ const key = await this.generateCacheKey(renderKey);
266
266
  const cached = await this._cache.get(key);
267
267
  if (cached) {
268
268
  return Buffer.from(cached);
@@ -271,7 +271,7 @@ var QrBit = class _QrBit extends Hookified {
271
271
  const svg = await this.toSvg();
272
272
  result = _QrBit.convertSvgToPng(svg);
273
273
  if (this._cache && options?.cache !== false) {
274
- const key = this.generateCacheKey(renderKey);
274
+ const key = await this.generateCacheKey(renderKey);
275
275
  await this._cache.set(key, result);
276
276
  }
277
277
  return result;
@@ -303,7 +303,7 @@ var QrBit = class _QrBit extends Hookified {
303
303
  const quality = options?.quality ?? 90;
304
304
  const renderKey = `napi-jpeg-${quality}`;
305
305
  if (this._cache && options?.cache !== false) {
306
- const key = this.generateCacheKey(renderKey);
306
+ const key = await this.generateCacheKey(renderKey);
307
307
  const cached = await this._cache.get(key);
308
308
  if (cached) {
309
309
  return Buffer.from(cached);
@@ -312,7 +312,7 @@ var QrBit = class _QrBit extends Hookified {
312
312
  const svg = await this.toSvg();
313
313
  result = _QrBit.convertSvgToJpeg(svg, void 0, void 0, quality);
314
314
  if (this._cache && options?.cache !== false) {
315
- const key = this.generateCacheKey(renderKey);
315
+ const key = await this.generateCacheKey(renderKey);
316
316
  await this._cache.set(key, result);
317
317
  }
318
318
  return result;
@@ -370,9 +370,9 @@ var QrBit = class _QrBit extends Hookified {
370
370
  /**
371
371
  * Generate a cache key based on the current QR code options.
372
372
  * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`
373
- * @returns {string} The cache key
373
+ * @returns {Promise<string>} The cache key
374
374
  */
375
- generateCacheKey(renderKey) {
375
+ async generateCacheKey(renderKey) {
376
376
  const qrOptions = {
377
377
  text: this._text,
378
378
  size: this._size,
package/dist/qrbit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/qrbit.ts"],"sourcesContent":["import { Buffer } from \"node:buffer\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Cacheable } from \"cacheable\";\nimport { Hookified, type HookifiedOptions } from \"hookified\";\nimport QRCode, { type QRCodeToStringOptions } from \"qrcode\";\nimport {\n\tconvertSvgToJpeg as nativeConvertSvgToJpeg,\n\tconvertSvgToPng as nativeConvertSvgToPng,\n\tgenerateQrSvg as nativeGenerateQrSvg,\n\tgenerateQrSvgWithBuffer as nativeGenerateQrSvgWithBuffer,\n} from \"./native.js\";\n\nexport enum QrBitEvents {\n\twarn = \"warn\",\n\tinfo = \"info\",\n\terror = \"error\",\n}\n\nconst logoFileDoesNotExistMessage = (logo: string) =>\n\t`Logo file not found: ${logo}. Proceeding without logo.`;\n\nexport type QrOptions = {\n\t/**\n\t * The text content to encode in the QR code. It can be text or a url.\n\t * @type {string}\n\t */\n\ttext: string;\n\t/**\n\t * The size of the QR code in pixels.\n\t * @type {number}\n\t * @default 200\n\t */\n\tsize?: number;\n\t/**\n\t * The margin around the QR code in pixels.\n\t * @type {number}\n\t */\n\tmargin?: number;\n\t/**\n\t * The logo to embed in the QR code.\n\t * @type {string | Buffer}\n\t */\n\tlogo?: string | Buffer;\n\t/**\n\t * The logo size ratio relative to QR code size.\n\t * @type {number}\n\t * @default 0.2\n\t */\n\tlogoSizeRatio?: number;\n\t/**\n\t * The background color of the QR code.\n\t * @type {string}\n\t * @default \"#FFFFFF\"\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The foreground color of the QR code.\n\t * @type {string}\n\t * @default \"#000000\"\n\t */\n\tforegroundColor?: string;\n\t/**\n\t * Caching is enabled by default. You can disable it by setting this option to false. You can also pass\n\t * a custom Cacheable instance.\n\t * @type {Cacheable | boolean}\n\t * @default true\n\t */\n\tcache?: Cacheable | boolean;\n} & HookifiedOptions;\n\nexport interface QrResult {\n\tsvg?: string;\n\tpng?: Buffer;\n\twidth: number;\n\theight: number;\n}\n\nexport type toOptions = {\n\tcache?: boolean;\n\tquality?: number;\n};\n\n/**\n * QR code generator with logo support and caching capabilities.\n * Supports both file path and buffer-based logos with automatic optimization.\n */\nexport class QrBit extends Hookified {\n\tprivate _text: string;\n\tprivate _size: number;\n\tprivate _margin: number | undefined;\n\tprivate _logo: string | Buffer | undefined;\n\tprivate _logoSizeRatio: number;\n\tprivate _backgroundColor: string;\n\tprivate _foregroundColor: string;\n\tprivate _cache: Cacheable | undefined;\n\tprivate _napi = {\n\t\tconvertSvgToJpeg: nativeConvertSvgToJpeg,\n\t\tconvertSvgToPng: nativeConvertSvgToPng,\n\t\tgenerateQrSvg: nativeGenerateQrSvg,\n\t\tgenerateQrSvgWithBuffer: nativeGenerateQrSvgWithBuffer,\n\t};\n\n\t/**\n\t * Create a new QrBit instance.\n\t * @param options - Configuration options for the QR code\n\t */\n\tconstructor(options: QrOptions) {\n\t\tsuper();\n\t\tthis._text = options.text;\n\t\tthis._size = options.size ?? 200;\n\t\tthis._margin = options.margin ?? undefined;\n\t\tthis._logo = options.logo;\n\t\tthis._logoSizeRatio = options.logoSizeRatio ?? 0.2;\n\t\tthis._backgroundColor = options.backgroundColor ?? \"#FFFFFF\";\n\t\tthis._foregroundColor = options.foregroundColor ?? \"#000000\";\n\t\tif (options.cache !== undefined) {\n\t\t\t// if it is boolean and true then create a new cacheable instance\n\t\t\tif (options.cache === true) {\n\t\t\t\tthis._cache = new Cacheable();\n\t\t\t} else if (options.cache !== false) {\n\t\t\t\t// it is a cacheable instance\n\t\t\t\tthis._cache = options.cache as Cacheable;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._cache = new Cacheable();\n\t\t}\n\n\t\t// set throwOnEmitError to true if there are no listeners\n\t\tthis.throwOnEmitError = true;\n\t}\n\n\t/**\n\t * Get the text content for the QR code.\n\t * @returns {string} The text content\n\t */\n\tpublic get text(): string {\n\t\treturn this._text;\n\t}\n\n\t/**\n\t * Set the text content for the QR code.\n\t * @param value - The text content to encode\n\t */\n\tpublic set text(value: string) {\n\t\tthis._text = value;\n\t}\n\n\t/**\n\t * Get the size of the QR code in pixels.\n\t * @returns {number} The size in pixels\n\t * @default 200\n\t */\n\tpublic get size(): number {\n\t\treturn this._size;\n\t}\n\n\t/**\n\t * Set the size of the QR code in pixels.\n\t * @param value - The size in pixels\n\t */\n\tpublic set size(value: number) {\n\t\tthis._size = value;\n\t}\n\n\t/**\n\t * Get the margin around the QR code in pixels.\n\t * @returns {number | undefined} The margin in pixels\n\t */\n\tpublic get margin(): number | undefined {\n\t\treturn this._margin;\n\t}\n\n\t/**\n\t * Set the margin around the QR code in pixels.\n\t * @param value - The margin in pixels\n\t */\n\tpublic set margin(value: number | undefined) {\n\t\tthis._margin = value;\n\t}\n\n\t/**\n\t * Get the logo path or buffer.\n\t * @returns {string | Buffer | undefined} The logo path, buffer, or undefined if no logo\n\t * @default undefined\n\t */\n\tpublic get logo(): string | Buffer | undefined {\n\t\treturn this._logo;\n\t}\n\n\t/**\n\t * Set the logo as a file path or buffer.\n\t * @param value - The logo file path, buffer, or undefined to remove logo\n\t */\n\tpublic set logo(value: string | Buffer | undefined) {\n\t\tthis._logo = value;\n\t}\n\n\t/**\n\t * Get the logo size ratio relative to QR code size.\n\t * @returns {number} The logo size ratio\n\t * @default 0.2\n\t */\n\tpublic get logoSizeRatio(): number {\n\t\treturn this._logoSizeRatio;\n\t}\n\n\t/**\n\t * Set the logo size ratio relative to QR code size.\n\t * @param value - The logo size ratio (0.0 to 1.0)\n\t */\n\tpublic set logoSizeRatio(value: number) {\n\t\tthis._logoSizeRatio = value;\n\t}\n\n\t/**\n\t * Get the background color of the QR code.\n\t * @returns {string} The background color in hex format\n\t * @default \"#FFFFFF\"\n\t */\n\tpublic get backgroundColor(): string {\n\t\treturn this._backgroundColor;\n\t}\n\n\t/**\n\t * Set the background color of the QR code.\n\t * @param value - The background color in hex format (e.g., \"#FFFFFF\")\n\t */\n\tpublic set backgroundColor(value: string) {\n\t\tthis._backgroundColor = value;\n\t}\n\n\t/**\n\t * Get the foreground color of the QR code.\n\t * @returns {string} The foreground color in hex format\n\t * @default \"#000000\"\n\t */\n\tpublic get foregroundColor(): string {\n\t\treturn this._foregroundColor;\n\t}\n\n\t/**\n\t * Set the foreground color of the QR code.\n\t * @param value - The foreground color in hex format (e.g., \"#000000\")\n\t */\n\tpublic set foregroundColor(value: string) {\n\t\tthis._foregroundColor = value;\n\t}\n\n\t/**\n\t * Get the cache instance.\n\t * @returns {Cacheable | undefined} The cache instance or undefined if caching is disabled\n\t */\n\tpublic get cache(): Cacheable | undefined {\n\t\treturn this._cache;\n\t}\n\n\t/**\n\t * Set the cache instance.\n\t * @param value - The cache instance or undefined to disable caching\n\t */\n\tpublic set cache(value: Cacheable | undefined) {\n\t\tthis._cache = value;\n\t}\n\n\t/**\n\t * Generate SVG QR code with optional caching.\n\t * Uses QRCode library for simple cases, Rust implementation for logos.\n\t * @param {toOptions} options - Generation options whether to use caching (default: true)\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvg(options?: toOptions): Promise<string> {\n\t\tlet result = \"\";\n\t\tlet renderKey = `native-svg`;\n\n\t\tif (this._logo) {\n\t\t\trenderKey = `napi-svg`;\n\t\t}\n\n\t\t// set all the options\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t};\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<string>(key);\n\t\t\tif (cached) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t}\n\n\t\tif (!this._logo) {\n\t\t\tconst qrCodeOptions: QRCodeToStringOptions = {\n\t\t\t\ttype: \"svg\",\n\t\t\t\twidth: qrOptions.size,\n\t\t\t\tcolor: {\n\t\t\t\t\tdark: qrOptions.foregroundColor,\n\t\t\t\t\tlight: qrOptions.backgroundColor,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tresult = await QRCode.toString(this._text, qrCodeOptions);\n\t\t} else {\n\t\t\t// If logoPath is set, use the Rust implementation\n\t\t\tresult = await this.toSvgNapi();\n\t\t}\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate SVG QR code using the native Rust implementation.\n\t * Automatically chooses between file path and buffer functions.\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvgNapi(): Promise<string> {\n\t\t// Choose optimal path based on logo type\n\t\tif (this._logo && Buffer.isBuffer(this._logo)) {\n\t\t\t// Logo is already a buffer - use buffer function\n\t\t\tconst nativeOptionsBuffer = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoBuffer: this._logo,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\t\t\treturn this._napi.generateQrSvgWithBuffer(nativeOptionsBuffer);\n\t\t} else {\n\t\t\t// Logo is a string path or undefined - use original function\n\t\t\tconst nativeOptions = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoPath: this._logo as string,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\n\t\t\tif (this._logo && this.isLogoString()) {\n\t\t\t\tif (!(await this.logoFileExists(this._logo as string))) {\n\t\t\t\t\tthis.emit(\n\t\t\t\t\t\tQrBitEvents.error,\n\t\t\t\t\t\tlogoFileDoesNotExistMessage(this._logo as string),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this._napi.generateQrSvg(nativeOptions);\n\t\t}\n\t}\n\n\t/**\n\t * Generate PNG QR code with optional caching.\n\t * Generates the QR as Svg either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<Buffer>} The PNG buffer\n\t */\n\tpublic async toPng(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst renderKey = `napi-png`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToPng(svg);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate PNG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the PNG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toPngFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst pngBuffer = await this.toPng(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, pngBuffer);\n\t}\n\n\t/**\n\t * Generate JPEG QR code with optional caching.\n\t * Generates the QR as SVG either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<Buffer>} The JPEG buffer\n\t */\n\tpublic async toJpg(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst quality = options?.quality ?? 90;\n\t\tconst renderKey = `napi-jpeg-${quality}`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToJpeg(svg, undefined, undefined, quality);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate JPEG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the JPEG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toJpgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst jpegBuffer = await this.toJpg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, jpegBuffer);\n\t}\n\n\t/**\n\t * Generate SVG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the SVG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toSvgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst svgString = await this.toSvg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, svgString, \"utf8\");\n\t}\n\n\t/**\n\t * Convert SVG content to PNG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the PNG output\n\t * @param height - Optional height for the PNG output\n\t * @returns {Buffer} The PNG buffer\n\t */\n\tpublic static convertSvgToPng(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToPng(svgContent, width, height);\n\t}\n\n\t/**\n\t * Convert SVG content to JPEG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the JPEG output\n\t * @param height - Optional height for the JPEG output\n\t * @param quality - Optional JPEG quality 1-100 (default: 90)\n\t * @returns {Buffer} The JPEG buffer\n\t */\n\tpublic static convertSvgToJpeg(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t\tquality?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToJpeg(svgContent, width, height, quality);\n\t}\n\n\t/**\n\t * Generate a cache key based on the current QR code options.\n\t * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`\n\t * @returns {string} The cache key\n\t */\n\tpublic generateCacheKey(renderKey: string): string {\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo || undefined,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t\trenderKey,\n\t\t};\n\n\t\tconst cache = this._cache || new Cacheable();\n\n\t\treturn cache.hash(qrOptions);\n\t}\n\n\t/**\n\t * Check if the logo is a string (file path).\n\t * @returns {boolean} True if logo is a string, false otherwise\n\t */\n\tpublic isLogoString(): boolean {\n\t\treturn typeof this._logo === \"string\";\n\t}\n\n\t/**\n\t * Check if a logo file exists at the specified path.\n\t * @param filePath - The file path to check\n\t * @returns {Promise<boolean>} True if file exists, false otherwise\n\t */\n\tpublic async logoFileExists(filePath: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.promises.access(filePath, fs.constants.F_OK);\n\t\t\treturn true;\n\t\t} catch (_error) {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,iBAAwC;AACjD,OAAO,YAA4C;AACnD;AAAA,EACC,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,OACrB;AAEA,IAAK,cAAL,kBAAKA,iBAAL;AACN,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,WAAQ;AAHG,SAAAA;AAAA,GAAA;AAMZ,IAAM,8BAA8B,CAAC,SACpC,wBAAwB,IAAI;AAmEtB,IAAM,QAAN,MAAM,eAAc,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBpC,YAAY,SAAoB;AAC/B,UAAM;AAZP,SAAQ,QAAQ;AAAA,MACf,kBAAkB;AAAA,MAClB,iBAAiB;A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;AAAA,MACpB,eAAe,KAAK;AAAA,MACpB,iBAAiB,KAAK;AAAA,MACtB,iBAAiB,KAAK;AAAA,MACtB;AAAA,IACD;AAEA,UAAM,QAAQ,KAAK,UAAU,IAAI,UAAU;AAE3C,WAAO,MAAM,KAAK,SAAS;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,eAAwB;AAC9B,WAAO,OAAO,KAAK,UAAU;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,eAAe,UAAoC;AAC/D,QAAI;AACH,YAAM,GAAG,SAAS,OAAO,UAAU,GAAG,UAAU,IAAI;AACpD,aAAO;AAAA,IACR,SAAS,QAAQ;AAChB,aAAO;AAAA,IACR;AAAA,EACD;AACD;","names":["QrBitEvents"]}
1
+ {"version":3,"sources":["../src/qrbit.ts"],"sourcesContent":["import { Buffer } from \"node:buffer\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Cacheable } from \"cacheable\";\nimport { Hookified, type HookifiedOptions } from \"hookified\";\nimport QRCode, { type QRCodeToStringOptions } from \"qrcode\";\nimport {\n\tconvertSvgToJpeg as nativeConvertSvgToJpeg,\n\tconvertSvgToPng as nativeConvertSvgToPng,\n\tgenerateQrSvg as nativeGenerateQrSvg,\n\tgenerateQrSvgWithBuffer as nativeGenerateQrSvgWithBuffer,\n} from \"./native.js\";\n\nexport enum QrBitEvents {\n\twarn = \"warn\",\n\tinfo = \"info\",\n\terror = \"error\",\n}\n\nconst logoFileDoesNotExistMessage = (logo: string) =>\n\t`Logo file not found: ${logo}. Proceeding without logo.`;\n\nexport type QrOptions = {\n\t/**\n\t * The text content to encode in the QR code. It can be text or a url.\n\t * @type {string}\n\t */\n\ttext: string;\n\t/**\n\t * The size of the QR code in pixels.\n\t * @type {number}\n\t * @default 200\n\t */\n\tsize?: number;\n\t/**\n\t * The margin around the QR code in pixels.\n\t * @type {number}\n\t */\n\tmargin?: number;\n\t/**\n\t * The logo to embed in the QR code.\n\t * @type {string | Buffer}\n\t */\n\tlogo?: string | Buffer;\n\t/**\n\t * The logo size ratio relative to QR code size.\n\t * @type {number}\n\t * @default 0.2\n\t */\n\tlogoSizeRatio?: number;\n\t/**\n\t * The background color of the QR code.\n\t * @type {string}\n\t * @default \"#FFFFFF\"\n\t */\n\tbackgroundColor?: string;\n\t/**\n\t * The foreground color of the QR code.\n\t * @type {string}\n\t * @default \"#000000\"\n\t */\n\tforegroundColor?: string;\n\t/**\n\t * Caching is enabled by default. You can disable it by setting this option to false. You can also pass\n\t * a custom Cacheable instance.\n\t * @type {Cacheable | boolean}\n\t * @default true\n\t */\n\tcache?: Cacheable | boolean;\n} & HookifiedOptions;\n\nexport interface QrResult {\n\tsvg?: string;\n\tpng?: Buffer;\n\twidth: number;\n\theight: number;\n}\n\nexport type toOptions = {\n\tcache?: boolean;\n\tquality?: number;\n};\n\n/**\n * QR code generator with logo support and caching capabilities.\n * Supports both file path and buffer-based logos with automatic optimization.\n */\nexport class QrBit extends Hookified {\n\tprivate _text: string;\n\tprivate _size: number;\n\tprivate _margin: number | undefined;\n\tprivate _logo: string | Buffer | undefined;\n\tprivate _logoSizeRatio: number;\n\tprivate _backgroundColor: string;\n\tprivate _foregroundColor: string;\n\tprivate _cache: Cacheable | undefined;\n\tprivate _napi = {\n\t\tconvertSvgToJpeg: nativeConvertSvgToJpeg,\n\t\tconvertSvgToPng: nativeConvertSvgToPng,\n\t\tgenerateQrSvg: nativeGenerateQrSvg,\n\t\tgenerateQrSvgWithBuffer: nativeGenerateQrSvgWithBuffer,\n\t};\n\n\t/**\n\t * Create a new QrBit instance.\n\t * @param options - Configuration options for the QR code\n\t */\n\tconstructor(options: QrOptions) {\n\t\tsuper();\n\t\tthis._text = options.text;\n\t\tthis._size = options.size ?? 200;\n\t\tthis._margin = options.margin ?? undefined;\n\t\tthis._logo = options.logo;\n\t\tthis._logoSizeRatio = options.logoSizeRatio ?? 0.2;\n\t\tthis._backgroundColor = options.backgroundColor ?? \"#FFFFFF\";\n\t\tthis._foregroundColor = options.foregroundColor ?? \"#000000\";\n\t\tif (options.cache !== undefined) {\n\t\t\t// if it is boolean and true then create a new cacheable instance\n\t\t\tif (options.cache === true) {\n\t\t\t\tthis._cache = new Cacheable();\n\t\t\t} else if (options.cache !== false) {\n\t\t\t\t// it is a cacheable instance\n\t\t\t\tthis._cache = options.cache as Cacheable;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._cache = new Cacheable();\n\t\t}\n\n\t\t// set throwOnEmitError to true if there are no listeners\n\t\tthis.throwOnEmitError = true;\n\t}\n\n\t/**\n\t * Get the text content for the QR code.\n\t * @returns {string} The text content\n\t */\n\tpublic get text(): string {\n\t\treturn this._text;\n\t}\n\n\t/**\n\t * Set the text content for the QR code.\n\t * @param value - The text content to encode\n\t */\n\tpublic set text(value: string) {\n\t\tthis._text = value;\n\t}\n\n\t/**\n\t * Get the size of the QR code in pixels.\n\t * @returns {number} The size in pixels\n\t * @default 200\n\t */\n\tpublic get size(): number {\n\t\treturn this._size;\n\t}\n\n\t/**\n\t * Set the size of the QR code in pixels.\n\t * @param value - The size in pixels\n\t */\n\tpublic set size(value: number) {\n\t\tthis._size = value;\n\t}\n\n\t/**\n\t * Get the margin around the QR code in pixels.\n\t * @returns {number | undefined} The margin in pixels\n\t */\n\tpublic get margin(): number | undefined {\n\t\treturn this._margin;\n\t}\n\n\t/**\n\t * Set the margin around the QR code in pixels.\n\t * @param value - The margin in pixels\n\t */\n\tpublic set margin(value: number | undefined) {\n\t\tthis._margin = value;\n\t}\n\n\t/**\n\t * Get the logo path or buffer.\n\t * @returns {string | Buffer | undefined} The logo path, buffer, or undefined if no logo\n\t * @default undefined\n\t */\n\tpublic get logo(): string | Buffer | undefined {\n\t\treturn this._logo;\n\t}\n\n\t/**\n\t * Set the logo as a file path or buffer.\n\t * @param value - The logo file path, buffer, or undefined to remove logo\n\t */\n\tpublic set logo(value: string | Buffer | undefined) {\n\t\tthis._logo = value;\n\t}\n\n\t/**\n\t * Get the logo size ratio relative to QR code size.\n\t * @returns {number} The logo size ratio\n\t * @default 0.2\n\t */\n\tpublic get logoSizeRatio(): number {\n\t\treturn this._logoSizeRatio;\n\t}\n\n\t/**\n\t * Set the logo size ratio relative to QR code size.\n\t * @param value - The logo size ratio (0.0 to 1.0)\n\t */\n\tpublic set logoSizeRatio(value: number) {\n\t\tthis._logoSizeRatio = value;\n\t}\n\n\t/**\n\t * Get the background color of the QR code.\n\t * @returns {string} The background color in hex format\n\t * @default \"#FFFFFF\"\n\t */\n\tpublic get backgroundColor(): string {\n\t\treturn this._backgroundColor;\n\t}\n\n\t/**\n\t * Set the background color of the QR code.\n\t * @param value - The background color in hex format (e.g., \"#FFFFFF\")\n\t */\n\tpublic set backgroundColor(value: string) {\n\t\tthis._backgroundColor = value;\n\t}\n\n\t/**\n\t * Get the foreground color of the QR code.\n\t * @returns {string} The foreground color in hex format\n\t * @default \"#000000\"\n\t */\n\tpublic get foregroundColor(): string {\n\t\treturn this._foregroundColor;\n\t}\n\n\t/**\n\t * Set the foreground color of the QR code.\n\t * @param value - The foreground color in hex format (e.g., \"#000000\")\n\t */\n\tpublic set foregroundColor(value: string) {\n\t\tthis._foregroundColor = value;\n\t}\n\n\t/**\n\t * Get the cache instance.\n\t * @returns {Cacheable | undefined} The cache instance or undefined if caching is disabled\n\t */\n\tpublic get cache(): Cacheable | undefined {\n\t\treturn this._cache;\n\t}\n\n\t/**\n\t * Set the cache instance.\n\t * @param value - The cache instance or undefined to disable caching\n\t */\n\tpublic set cache(value: Cacheable | undefined) {\n\t\tthis._cache = value;\n\t}\n\n\t/**\n\t * Generate SVG QR code with optional caching.\n\t * Uses QRCode library for simple cases, Rust implementation for logos.\n\t * @param {toOptions} options - Generation options whether to use caching (default: true)\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvg(options?: toOptions): Promise<string> {\n\t\tlet result = \"\";\n\t\tlet renderKey = `native-svg`;\n\n\t\tif (this._logo) {\n\t\t\trenderKey = `napi-svg`;\n\t\t}\n\n\t\t// set all the options\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t};\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<string>(key);\n\t\t\tif (cached) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t}\n\n\t\tif (!this._logo) {\n\t\t\tconst qrCodeOptions: QRCodeToStringOptions = {\n\t\t\t\ttype: \"svg\",\n\t\t\t\twidth: qrOptions.size,\n\t\t\t\tcolor: {\n\t\t\t\t\tdark: qrOptions.foregroundColor,\n\t\t\t\t\tlight: qrOptions.backgroundColor,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tresult = await QRCode.toString(this._text, qrCodeOptions);\n\t\t} else {\n\t\t\t// If logoPath is set, use the Rust implementation\n\t\t\tresult = await this.toSvgNapi();\n\t\t}\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate SVG QR code using the native Rust implementation.\n\t * Automatically chooses between file path and buffer functions.\n\t * @returns {Promise<string>} The SVG string\n\t */\n\tpublic async toSvgNapi(): Promise<string> {\n\t\t// Choose optimal path based on logo type\n\t\tif (this._logo && Buffer.isBuffer(this._logo)) {\n\t\t\t// Logo is already a buffer - use buffer function\n\t\t\tconst nativeOptionsBuffer = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoBuffer: this._logo,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\t\t\treturn this._napi.generateQrSvgWithBuffer(nativeOptionsBuffer);\n\t\t} else {\n\t\t\t// Logo is a string path or undefined - use original function\n\t\t\tconst nativeOptions = {\n\t\t\t\ttext: this._text,\n\t\t\t\tsize: this._size,\n\t\t\t\tmargin: this._margin,\n\t\t\t\tlogoPath: this._logo as string,\n\t\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\t\tforegroundColor: this._foregroundColor,\n\t\t\t};\n\n\t\t\tif (this._logo && this.isLogoString()) {\n\t\t\t\tif (!(await this.logoFileExists(this._logo as string))) {\n\t\t\t\t\tthis.emit(\n\t\t\t\t\t\tQrBitEvents.error,\n\t\t\t\t\t\tlogoFileDoesNotExistMessage(this._logo as string),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this._napi.generateQrSvg(nativeOptions);\n\t\t}\n\t}\n\n\t/**\n\t * Generate PNG QR code with optional caching.\n\t * Generates the QR as Svg either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<Buffer>} The PNG buffer\n\t */\n\tpublic async toPng(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst renderKey = `napi-png`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToPng(svg);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate PNG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the PNG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toPngFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst pngBuffer = await this.toPng(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, pngBuffer);\n\t}\n\n\t/**\n\t * Generate JPEG QR code with optional caching.\n\t * Generates the QR as SVG either in rust if it has a logo or native. Then does a conversion on it.\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<Buffer>} The JPEG buffer\n\t */\n\tpublic async toJpg(options?: toOptions): Promise<Buffer> {\n\t\tlet result: Buffer;\n\t\tconst quality = options?.quality ?? 90;\n\t\tconst renderKey = `napi-jpeg-${quality}`;\n\n\t\t// check the cache\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\tconst cached = await this._cache.get<Buffer>(key);\n\t\t\tif (cached) {\n\t\t\t\t// Ensure we return a Buffer, not Uint8Array\n\t\t\t\treturn Buffer.from(cached);\n\t\t\t}\n\t\t}\n\n\t\tconst svg = await this.toSvg();\n\t\tresult = QrBit.convertSvgToJpeg(svg, undefined, undefined, quality);\n\n\t\tif (this._cache && options?.cache !== false) {\n\t\t\t// set the cache, generate the key from hash\n\t\t\tconst key = await this.generateCacheKey(renderKey);\n\t\t\t// cache the value\n\t\t\tawait this._cache.set(key, result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Generate JPEG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the JPEG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @param options.quality - JPEG quality 1-100 (default: 90)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toJpgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst jpegBuffer = await this.toJpg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, jpegBuffer);\n\t}\n\n\t/**\n\t * Generate SVG QR code and save it to a file.\n\t * Creates directories if they don't exist.\n\t * @param filePath - The file path where to save the SVG\n\t * @param options - Generation options\n\t * @param options.cache - Whether to use caching (default: true)\n\t * @returns {Promise<void>} Resolves when file is written\n\t */\n\tpublic async toSvgFile(filePath: string, options?: toOptions): Promise<void> {\n\t\tconst svgString = await this.toSvg(options);\n\n\t\t// Create directory if it doesn't exist\n\t\tconst dir = path.dirname(filePath);\n\t\tawait fs.promises.mkdir(dir, { recursive: true });\n\n\t\tawait fs.promises.writeFile(filePath, svgString, \"utf8\");\n\t}\n\n\t/**\n\t * Convert SVG content to PNG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the PNG output\n\t * @param height - Optional height for the PNG output\n\t * @returns {Buffer} The PNG buffer\n\t */\n\tpublic static convertSvgToPng(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToPng(svgContent, width, height);\n\t}\n\n\t/**\n\t * Convert SVG content to JPEG buffer using the native Rust implementation.\n\t * @param svgContent - The SVG content as a string\n\t * @param width - Optional width for the JPEG output\n\t * @param height - Optional height for the JPEG output\n\t * @param quality - Optional JPEG quality 1-100 (default: 90)\n\t * @returns {Buffer} The JPEG buffer\n\t */\n\tpublic static convertSvgToJpeg(\n\t\tsvgContent: string,\n\t\twidth?: number,\n\t\theight?: number,\n\t\tquality?: number,\n\t): Buffer {\n\t\treturn nativeConvertSvgToJpeg(svgContent, width, height, quality);\n\t}\n\n\t/**\n\t * Generate a cache key based on the current QR code options.\n\t * @param {string} renderKey the format that you are rendering in such as `napi-png`, `native-svg`, `napi-svg`\n\t * @returns {Promise<string>} The cache key\n\t */\n\tpublic async generateCacheKey(renderKey: string): Promise<string> {\n\t\tconst qrOptions = {\n\t\t\ttext: this._text,\n\t\t\tsize: this._size,\n\t\t\tmargin: this._margin,\n\t\t\tlogo: this._logo || undefined,\n\t\t\tlogoSizeRatio: this._logoSizeRatio,\n\t\t\tbackgroundColor: this._backgroundColor,\n\t\t\tforegroundColor: this._foregroundColor,\n\t\t\trenderKey,\n\t\t};\n\n\t\tconst cache = this._cache || new Cacheable();\n\n\t\treturn cache.hash(qrOptions);\n\t}\n\n\t/**\n\t * Check if the logo is a string (file path).\n\t * @returns {boolean} True if logo is a string, false otherwise\n\t */\n\tpublic isLogoString(): boolean {\n\t\treturn typeof this._logo === \"string\";\n\t}\n\n\t/**\n\t * Check if a logo file exists at the specified path.\n\t * @param filePath - The file path to check\n\t * @returns {Promise<boolean>} True if file exists, false otherwise\n\t */\n\tpublic async logoFileExists(filePath: string): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.promises.access(filePath, fs.constants.F_OK);\n\t\t\treturn true;\n\t\t} catch (_error) {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,iBAAwC;AACjD,OAAO,YAA4C;AACnD;AAAA,EACC,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,OACrB;AAEA,IAAK,cAAL,kBAAKA,iBAAL;AACN,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,UAAO;A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A;AAAA;AAAA;AAAA;AAAA,EAUA,OAAc,iBACb,YACA,OACA,QACA,SACS;AACT,WAAO,uBAAuB,YAAY,OAAO,QAAQ,OAAO;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,iBAAiB,WAAoC;AACjE,UAAM,YAAY;AAAA,MACjB,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK,SAAS;AAAA,MACpB,eAAe,KAAK;AAAA,MACpB,iBAAiB,KAAK;AAAA,MACtB,iBAAiB,KAAK;AAAA,MACtB;AAAA,IACD;AAEA,UAAM,QAAQ,KAAK,UAAU,IAAI,UAAU;AAE3C,WAAO,MAAM,KAAK,SAAS;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,eAAwB;AAC9B,WAAO,OAAO,KAAK,UAAU;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAa,eAAe,UAAoC;AAC/D,QAAI;AACH,YAAM,GAAG,SAAS,OAAO,UAAU,GAAG,UAAU,IAAI;AACpD,aAAO;AAAA,IACR,SAAS,QAAQ;AAChB,aAAO;AAAA,IACR;AAAA,EACD;AACD;","names":["QrBitEvents"]}
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qrbit",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "A fast QR code generator with logo embedding support",
5
5
  "type": "module",
6
6
  "main": "dist/qrbit.cjs",
@@ -13,6 +13,10 @@
13
13
  "require": "./dist/qrbit.cjs"
14
14
  }
15
15
  },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
16
20
  "files": [
17
21
  "dist"
18
22
  ],
@@ -41,20 +45,20 @@
41
45
  "version": "napi version"
42
46
  },
43
47
  "devDependencies": {
44
- "@biomejs/biome": "^2.3.3",
48
+ "@biomejs/biome": "^2.3.7",
45
49
  "@faker-js/faker": "^10.1.0",
46
50
  "@loskir/styled-qr-code-node": "^1.5.2",
47
51
  "@monstermann/tinybench-pretty-printer": "^0.2.0",
48
52
  "@napi-rs/cli": "^3.4.1",
49
- "@types/node": "^24.10.0",
53
+ "@types/node": "^24.10.1",
50
54
  "@types/qrcode": "^1.5.6",
51
- "@vitest/coverage-v8": "^4.0.6",
52
- "rimraf": "^6.1.0",
55
+ "@vitest/coverage-v8": "^4.0.14",
56
+ "rimraf": "^6.1.2",
53
57
  "tinybench": "^5.1.0",
54
- "tsup": "^8.5.0",
58
+ "tsup": "^8.5.1",
55
59
  "tsx": "^4.20.6",
56
60
  "typescript": "^5.9.3",
57
- "vitest": "^4.0.6"
61
+ "vitest": "^4.0.14"
58
62
  },
59
63
  "repository": {
60
64
  "type": "git",
@@ -92,8 +96,8 @@
92
96
  ]
93
97
  },
94
98
  "dependencies": {
95
- "cacheable": "^2.1.1",
96
- "hookified": "^1.12.2",
99
+ "cacheable": "^2.2.0",
100
+ "hookified": "^1.13.0",
97
101
  "qrcode": "^1.5.4"
98
102
  }
99
103
  }