qrcode-generator-sabai
Version:
qrcode-generator-sabai is a Node.js package designed to simplify QR code generation from various payloads to images. It offers ease of use and extensive customization options.
35 lines (32 loc) • 832 B
text/typescript
type eclType = 'L' | 'M' | 'Q' | 'H';
type BaseQRCodeOptions = {
size?: number;
errorCorrection?: eclType;
logoPath?: string | null;
};
type PngQRCodeOptions = BaseQRCodeOptions & {
format?: 'png';
filePath: string;
fileName: string;
};
type SvgQRCodeOptions = BaseQRCodeOptions & {
format: 'svg';
} & ({
filePath: string;
fileName: string;
} | {
filePath?: undefined;
fileName?: undefined;
});
type Base64QRCodeOptions = BaseQRCodeOptions & {
format: 'base64';
filePath?: never;
fileName?: never;
};
type QRCodeOptions = PngQRCodeOptions | SvgQRCodeOptions | Base64QRCodeOptions;
declare class QR {
constructor();
private static validateLogoPath;
static generate(payload: any, options: QRCodeOptions): Promise<string | boolean>;
}
export { QR, QR as default };