Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qrean

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qrean - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0-alpha.2

209

dist/Qrean.d.ts

@@ -6,17 +6,16 @@ type CreateOptions = {

type EncodeOptions = {
code_type?: keyof typeof Qrean.CODE_TYPES;
data_type?: keyof typeof Qrean.DATA_TYPES;
qr_version?: keyof typeof Qrean.QR_VERSIONS;
qr_maskpattern?: keyof typeof Qrean.QR_MASKPATTERNS;
qr_errorlevel?: keyof typeof Qrean.QR_ERRORLEVELS;
codeType?: keyof typeof Qrean.CODE_TYPES;
dataType?: keyof typeof Qrean.DATA_TYPES;
qrVersion?: keyof typeof Qrean.QR_VERSIONS;
qrMaskPattern?: keyof typeof Qrean.QR_MASKPATTERNS;
qrErrorLevel?: keyof typeof Qrean.QR_ERRORLEVELS;
scale?: number;
padding?: number[];
padding?: number[] | number;
};
type DetectOptions = {
gamma?: number;
eci_code?: 'UTF-8' | 'ShiftJIS' | 'Latin1';
outbuf_size?: number;
digitized?: Uint8ClampedArray;
eciCode?: 'UTF-8' | 'ShiftJIS' | 'Latin1';
outbufSize?: number;
};
type Image = {
export type Image = {
width: number;

@@ -26,10 +25,22 @@ height: number;

};
export type Detected = {
type: keyof typeof Qrean.CODE_TYPES;
text: string;
points: number[][];
qr?: {
version: keyof typeof Qrean.QR_VERSIONS;
mask: keyof typeof Qrean.QR_MASKPATTERNS;
level: keyof typeof Qrean.QR_ERRORLEVELS;
};
};
export declare class Qrean {
wasm: WebAssembly.WebAssemblyInstantiatedSource;
on_found?: (type: string, str: string) => void;
heap: number;
memory: WebAssembly.Memory;
private wasm;
private on_found?;
private instance;
private heap;
private memory;
private detected;
static create(opts?: CreateOptions): Promise<Qrean>;
private constructor();
memreset(): void;
constructor(opts?: CreateOptions);
private init;
static CODE_TYPE_QR: "QR";

@@ -72,2 +83,4 @@ static CODE_TYPE_MQR: "mQR";

static QR_VERSION_AUTO: "AUTO";
static QR_VERSION_AUTO_W: "AUTO-W";
static QR_VERSION_AUTO_H: "AUTO-H";
static QR_VERSION_1: "1";

@@ -152,79 +165,81 @@ static QR_VERSION_2: "2";

AUTO: 0;
"1": 1;
"2": 2;
"3": 3;
"4": 4;
"5": 5;
"6": 6;
"7": 7;
"8": 8;
"9": 9;
"10": 10;
"11": 11;
"12": 12;
"13": 13;
"14": 14;
"15": 15;
"16": 16;
"17": 17;
"18": 18;
"19": 19;
"20": 20;
"21": 21;
"22": 22;
"23": 23;
"24": 24;
"25": 25;
"26": 26;
"27": 27;
"28": 28;
"29": 29;
"30": 30;
"31": 31;
"32": 32;
"33": 33;
"34": 34;
"35": 35;
"36": 36;
"37": 37;
"38": 38;
"39": 39;
"40": 40;
M1: 41;
M2: 42;
M3: 43;
M4: 44;
R7x43: 45;
R7x59: 46;
R7x77: 47;
R7x99: 48;
R7x139: 49;
R9x43: 50;
R9x59: 51;
R9x77: 52;
R9x99: 53;
R9x139: 54;
R11x27: 55;
R11x43: 56;
R11x59: 57;
R11x77: 58;
R11x99: 59;
R11x139: 60;
R13x27: 61;
R13x43: 62;
R13x59: 63;
R13x77: 64;
R13x99: 65;
R13x139: 66;
R15x43: 67;
R15x59: 68;
R15x77: 69;
R15x99: 70;
R15x139: 71;
R17x43: 72;
R17x59: 73;
R17x77: 74;
R17x99: 75;
R17x139: 76;
TQR: 77;
"AUTO-W": 1;
"AUTO-H": 2;
"1": 3;
"2": 4;
"3": 5;
"4": 6;
"5": 7;
"6": 8;
"7": 9;
"8": 10;
"9": 11;
"10": 12;
"11": 13;
"12": 14;
"13": 15;
"14": 16;
"15": 17;
"16": 18;
"17": 19;
"18": 20;
"19": 21;
"20": 22;
"21": 23;
"22": 24;
"23": 25;
"24": 26;
"25": 27;
"26": 28;
"27": 29;
"28": 30;
"29": 31;
"30": 32;
"31": 33;
"32": 34;
"33": 35;
"34": 36;
"35": 37;
"36": 38;
"37": 39;
"38": 40;
"39": 41;
"40": 42;
M1: 43;
M2: 44;
M3: 45;
M4: 46;
R7x43: 47;
R7x59: 48;
R7x77: 49;
R7x99: 50;
R7x139: 51;
R9x43: 52;
R9x59: 53;
R9x77: 54;
R9x99: 55;
R9x139: 56;
R11x27: 57;
R11x43: 58;
R11x59: 59;
R11x77: 60;
R11x99: 61;
R11x139: 62;
R13x27: 63;
R13x43: 64;
R13x59: 65;
R13x77: 66;
R13x99: 67;
R13x139: 68;
R15x43: 69;
R15x59: 70;
R15x77: 71;
R15x99: 72;
R15x139: 73;
R17x43: 74;
R17x59: 75;
R17x77: 76;
R17x99: 77;
R17x139: 78;
TQR: 79;
};

@@ -269,10 +284,10 @@ static QR_ERRORLEVEL_L: "L";

};
encode(text: string, opts?: EncodeOptions | keyof typeof Qrean.CODE_TYPES): Image;
encode(text: string, opts?: EncodeOptions | keyof typeof Qrean.CODE_TYPES): Promise<false | Image>;
private allocImage;
private readImage;
detect(imgdata: Image, callback: (type: string, str: string) => void, opts?: DetectOptions): {
detected: number;
detect(imgdata: Image, opts?: DetectOptions, callback?: (obj: Detected) => void): Promise<{
detected: Detected[];
digitized: Image;
};
}>;
}
export {};
{
"name": "qrean",
"type": "module",
"version": "0.0.3",
"version": "0.1.0-alpha.2",
"description": "A portable QR and Barcode generation / manipulation library written in C",
"main": "./dist/Qrean.js",
"module": "./dist/Qrean.js",

@@ -15,6 +16,9 @@ "types": "./dist/Qrean.d.ts",

"license": "MIT",
"scripts": {
"version": "make dist && git add library.json dist/"
},
"devDependencies": {
"@types/node": "^20.11.3",
"@types/node": "^20.11.17",
"typescript": "^5.3.3"
}
}

@@ -13,4 +13,5 @@ QR and Barcode library `libqrean`

[WASM](https://kikuchan.github.io/libqrean/wasm/) (thanks @taisukef)
[Wasm](https://kikuchan.github.io/libqrean/wasm/) (thanks @taisukef)
# CLI Usage

@@ -20,10 +21,10 @@ ## Generation

% qrean -t rmqr Hello
███████████████████████████████████████████████████████████████████
███████████████████████████████████████████████████████████████████
████ ▄▄▄▄▄ █ █ ▀ █ ▀▄▀ ▄ █▄▀ █▄█ █▄▀ █▄█▄█ ▄ █▄█ ▀ █ ▀ █▄▀▄█ ▄ ████
████ █ █ █ ▀█▄███▄ █▄▄ ▄▄▄▄ █▄▀█▀▄▄ ▀ ▄▄ ▀█▄ ▄▀█▄ ▄▀ ▄▄▄ ████
████ █▄▄▄█ █▀▄ ██▀ ██▀ ▄ ▄▀▀██ ▀▀▀█▄ ▀█ ▄ ▄█▀ ██ ▄ ▄█ █▄█ ████
████▄▄▄▄▄▄▄█▄█▄█▄█▄█▄█▄▄▄█▄█▄█▄█▄█▄█▄█▄█▄█▄▄▄█▄█▄█▄█▄█▄█▄█▄▄▄▄▄████
███████████████████████████████████████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
███████████████████████████████
██ ▄▄▄▄▄ █ ▀ █ █ █▄█ █▄█▄█▄▄ ██
██ █ █ ██▄ ▄█▀▄▄ ▄▄ ▀█ ▄██
██ █▄▄▄█ ██▀▀▀▄█▄▄█▀█▄ █▀▀▄██
██▄▄▄▄▄▄▄█▄██ ▄ ▀▄█▀▀█▀▄ ▄▄▄ ██
██ ▄▀▀ ▀▄ ▄█▄███▀▀▄▄▀▄▀▄ █▄█ ██
██▄▄▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄▄▄▄▄██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
% qrean -t mQR Hello > mqr.png # CAVEAT: Outputs PNG stream for not a tty

@@ -106,2 +107,43 @@ % qrean -o qr.png Hello # You can also specify output filename

# JavaScript / TypeScript Usage (Powered by Wasm)
```js
import { Qrean } from 'qrean';
const qrean = new Qrean();
const img = await qrean.encode('Hello, world');
console.log(img);
// {
// width: 116,
// height: 116,
// data: Uint8ClampedArray(53824) [
// :
const { detected } = await qrean.detect(img);
console.log(detected[0].text);
// Hello, world
```
It requires Wasm to run, but don't worry, most engines support it; Node, Deno, Bun and browsers.
# Install
## As a CLI
* Windows
- Download from [Release Page](https://github.com/kikuchan/libqrean/releases)
* UNIX-like systems (Linux / macOS / *BSD)
- Just `make install`
## As a JavaScript / TypeScript library
```sh
% npm install qrean
```
## As a C library for embedded systems
Take a look at [src/](src/) and include (or copy) them!
# Why?

@@ -108,0 +150,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc