@qr-platform/qr-code.js 0.9.1 → 0.9.4
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/lib/chunks/save-debug-image-imagejs-B9Be6CPQ.js +1 -0
- package/lib/chunks/scan-validator-node-BSN87ekg.js +1 -0
- package/lib/chunks/scan-validator-worker-CwjgE5by.js +1 -0
- package/lib/chunks/scan-validator-zxing-node-CWPfVTN8.js +1 -0
- package/lib/index.js +1 -1
- package/lib/lib/zbar-wasm/QRValidatorZbarCustomInstanceWasm.d.ts +1 -0
- package/lib/lib/zbar-wasm/zbar-library.d.ts +2 -0
- package/lib/node/lib/zbar-wasm/QRValidatorZbarCustomInstanceWasm.d.ts +1 -0
- package/lib/node/lib/zbar-wasm/zbar-library.d.ts +2 -0
- package/lib/node/plugins/QRValidatorZbarWorker.d.ts +60 -0
- package/lib/node/utils/save-debug-image-imagejs.d.ts +9 -0
- package/lib/node/utils/scan-validator-worker.d.ts +15 -0
- package/lib/node/utils/scan-validators/abstract-scan-validator.d.ts +4 -0
- package/lib/node.js +1 -1
- package/lib/plugins/QRValidatorZbarWorker.d.ts +60 -0
- package/lib/utils/save-debug-image-imagejs.d.ts +9 -0
- package/lib/utils/scan-validator-worker.d.ts +15 -0
- package/lib/utils/scan-validators/abstract-scan-validator.d.ts +4 -0
- package/package.json +1 -1
- package/lib/chunks/scan-validator-node-BGUxkBJt.js +0 -1
- package/lib/chunks/scan-validator-zxing-node-CV9K2v4n.js +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
export function customInstantiateWasm(imports: any, successCallback: any): Promise<void>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export function customInstantiateWasm(imports: any, successCallback: any): Promise<void>;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/**
|
2
|
+
* QRValidatorZbar Validation Library for Node.js
|
3
|
+
*
|
4
|
+
* This server-side class uses zbar-wasm to decode QR codes and other barcodes,
|
5
|
+
* with Jimp (and Resvg for SVG conversion) for image processing.
|
6
|
+
*/
|
7
|
+
interface QRValidatorOptions {
|
8
|
+
/** Maximum number of retry attempts */
|
9
|
+
maxRetries?: number;
|
10
|
+
/** Time to wait between retries in milliseconds */
|
11
|
+
retryInterval?: number;
|
12
|
+
/** Enable debug logging */
|
13
|
+
debug?: boolean;
|
14
|
+
}
|
15
|
+
interface QRValidationResult {
|
16
|
+
/** Whether the validation was successful */
|
17
|
+
isValid: boolean;
|
18
|
+
/** Decoded data from the QR code (if successful) */
|
19
|
+
data?: string;
|
20
|
+
/** Format of the detected barcode */
|
21
|
+
format?: string;
|
22
|
+
/** Number of retry attempts made */
|
23
|
+
attempts?: number;
|
24
|
+
/** Whether the successful decode came from an inverted image */
|
25
|
+
isInverted?: boolean;
|
26
|
+
/** Error message if validation failed */
|
27
|
+
error?: string;
|
28
|
+
/** Error code if validation failed */
|
29
|
+
errorCode?: string;
|
30
|
+
}
|
31
|
+
declare class QRValidatorZbarNode {
|
32
|
+
private maxRetries;
|
33
|
+
private retryInterval;
|
34
|
+
private debug;
|
35
|
+
constructor(options?: QRValidatorOptions);
|
36
|
+
private log;
|
37
|
+
/**
|
38
|
+
* Validate and decode a QR code from an SVG string (or file path)
|
39
|
+
*/
|
40
|
+
validate(input: string, isInverted?: boolean): Promise<QRValidationResult>;
|
41
|
+
private sleep;
|
42
|
+
/**
|
43
|
+
* Process image using Sharp and get raw pixel data
|
44
|
+
* @param input Input image
|
45
|
+
* @param width Optional width for resizing
|
46
|
+
* @param height Optional height for resizing
|
47
|
+
* @returns Processed image data compatible with zbar-wasm
|
48
|
+
*/
|
49
|
+
private processImageResvg;
|
50
|
+
private validateWithRetry;
|
51
|
+
/**
|
52
|
+
* Save a debug image using Jimp. The raw image data is used to reconstruct an image.
|
53
|
+
*/
|
54
|
+
private saveDebugImage;
|
55
|
+
/**
|
56
|
+
* Decode the QR code from image data using zbar-wasm.
|
57
|
+
*/
|
58
|
+
private decodeQR;
|
59
|
+
}
|
60
|
+
export default QRValidatorZbarNode;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Save an RGBA or grayscale buffer as a PNG using image-js.
|
3
|
+
* @param buffer - Buffer or Uint8Array of pixel data (RGBA or grayscale)
|
4
|
+
* @param width - Image width
|
5
|
+
* @param height - Image height
|
6
|
+
* @param filename - Output PNG filename
|
7
|
+
* @param isGray - If true, buffer is grayscale; otherwise, RGBA
|
8
|
+
*/
|
9
|
+
export declare function saveDebugImageImageJs(buffer: Buffer | Uint8Array, width: number, height: number, filename: string, isGray?: boolean): Promise<void>;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ScanValidatorResponse } from './scan-validators/abstract-scan-validator';
|
2
|
+
/**
|
3
|
+
* QR Code validator for Node.js environment
|
4
|
+
*/
|
5
|
+
export declare const qrValidator: {
|
6
|
+
/**
|
7
|
+
* Validate QR code using zbar with SVG as input
|
8
|
+
* @param svgSource SVG string containing QR code
|
9
|
+
* @param width Width to use for validation
|
10
|
+
* @param height Height to use for validation
|
11
|
+
* @param debug Enable detailed debugging
|
12
|
+
* @returns Validation result
|
13
|
+
*/
|
14
|
+
validateZbar: (svgSource: string | undefined, debug?: boolean) => Promise<ScanValidatorResponse>;
|
15
|
+
};
|