Comparing version
@@ -1,6 +0,5 @@ | ||
/// <reference types="node" /> | ||
import { ImageOptions, Matrix } from "./typing/types"; | ||
export declare function getPNG(text: string, inOptions?: ImageOptions): Promise<Buffer>; | ||
export declare function getPNG(text: string, inOptions?: ImageOptions): Promise<Uint8ClampedArray>; | ||
export declare function generateImage({ matrix, size, margin, logo, logoWidth, logoHeight, color, bgColor, borderRadius, }: ImageOptions & { | ||
matrix: Matrix; | ||
}): Promise<Buffer>; | ||
}): Promise<Uint8ClampedArray>; |
@@ -1,6 +0,5 @@ | ||
/// <reference types="node" /> | ||
import { ImageOptions, Matrix } from "./typing/types"; | ||
export declare function getPNG(text: string, inOptions?: ImageOptions): Promise<Buffer>; | ||
export declare function getPNG(text: string, inOptions?: ImageOptions): Promise<Uint8ClampedArray>; | ||
export declare function generateImage({ matrix, size, margin, logo, logoWidth, logoHeight, color, bgColor, borderRadius, }: ImageOptions & { | ||
matrix: Matrix; | ||
}): Promise<Buffer>; | ||
}): Promise<Uint8ClampedArray>; |
@@ -28,4 +28,5 @@ import { QR } from "./qr-base.js"; | ||
} | ||
return await qrImage.png().toBuffer(); | ||
const { data } = await qrImage.png().toBuffer({ resolveWithObject: true }); | ||
return new Uint8ClampedArray(data.buffer); | ||
} | ||
//# sourceMappingURL=png.js.map |
@@ -228,2 +228,8 @@ import test from "ava"; | ||
}, | ||
{ | ||
name: "PNG memory usage", | ||
fn: getPNG, | ||
filename: "qr_large.png", | ||
params: { size: 300, margin: 10 }, | ||
} | ||
].forEach((testData) => { | ||
@@ -230,0 +236,0 @@ test.serial(testData.name, async (t) => { |
{ | ||
"name": "qreator", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"description": "QR Code generator for browser and node.js with tree shaking and logo support", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Short-io/qreator", |
@@ -41,3 +41,4 @@ import { ImageOptions, Matrix } from "./typing/types"; | ||
} | ||
return await qrImage.png().toBuffer(); | ||
const { data } = await qrImage.png().toBuffer({ resolveWithObject: true}); | ||
return new Uint8ClampedArray(data.buffer); | ||
} |
@@ -241,2 +241,8 @@ import test from "ava"; | ||
}, | ||
{ | ||
name: "PNG memory usage", | ||
fn: getPNG, | ||
filename: "qr_large.png", | ||
params: { size: 300, margin: 10 }, | ||
} | ||
] as TestParams[]).forEach((testData) => { | ||
@@ -243,0 +249,0 @@ test.serial(testData.name, async (t) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3798868
0.02%32273
0.04%