Socket
Socket
Sign inDemoInstall

@types/qrcode

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/qrcode - npm Package Compare versions

Comparing version 0.0.2 to 0.8.0

qrcode/LICENSE

218

qrcode/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for qrcode
// Type definitions for qrcode 0.8.2
// Project: https://github.com/soldair/node-qrcode

@@ -6,31 +6,199 @@ // Definitions by: York Yao <https://github.com/plantain-00/>

type QRCodeOptions = {
errorCorrectLevel?: "minimum" | "medium" | "high" | "max";
/// <reference types="node" />
import * as stream from "stream";
export interface QRCodeOptions {
/**
* QR Code version. If not specified the more suitable value will be calculated.
*/
version?: number;
/**
* Error correction level.
* Possible values are low, medium, quartile, high or L, M, Q, H.
* Default: M
*/
errorCorrectionLevel?: "low" | "medium" | "quartile" | "high" | "L" | "M" | "Q" | "H";
/**
* Helper function used internally to convert a kanji to its Shift JIS value.
* Provide this function if you need support for Kanji mode.
*/
toSJISFunc?: Function;
}
declare module "qrcode" {
var qrcode: {
toDataURL(text: string, callback: (error: Error, dataURL: string) => void): void;
toDataURL(text: string, options: QRCodeOptions, callback: (error: Error, dataURL: string) => void): void;
draw(text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void;
draw(text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void;
drawSvg(text: string, callback: (error: Error, svgString: string) => void): void;
drawSvg(text: string, options: QRCodeOptions, callback: (error: Error, svgString: string) => void): void;
save(path: string, text: string, callback: (error: Error, written: any) => void): void;
save(path: string, text: string, options: QRCodeOptions, callback: (error: Error, written: any) => void): void;
drawText(text: string, callback: (error: Error) => void): void;
drawText(text: string, options: QRCodeOptions, callback: (error: Error) => void): void;
drawBitArray(text: string, callback: (error: Error, bits: any, width: number) => void): void;
drawBitArray(text: string, options: QRCodeOptions, callback: (error: Error, bits: any, width: number) => void): void;
export interface QRCodeToDataURLOptions extends QRCodeRenderersOptions {
/**
* Data URI format.
* Default: image/png
*/
type?: "image/png" | "image/jpeg" | "image/webp";
rendererOpts?: {
/**
* A Number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp.
* Default: 0.92
*/
quality?: number;
};
export = qrcode;
}
declare var QRCodeLib: {
QRCodeDraw: {
new (): {
draw(element: HTMLCanvasElement, text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void;
draw(element: HTMLCanvasElement, text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void;
}
export interface QRCodeToStringOptions extends QRCodeOptions {
/**
* Output format.
* Default: utf8
*/
type?: "utf8" | "svg" | "terminal";
}
export interface QRCodeToFileOptions extends QRCodeRenderersOptions {
/**
* Output format.
* Default: png
*/
type?: "png" | "svg" | "utf8";
rendererOpts?: {
/**
* Compression level for deflate.
* Default: 9
*/
deflateLevel?: number;
/**
* Compression strategy for deflate.
* Default: 3
*/
deflateStrategy?: number;
};
};
}
export interface QRCodeRenderersOptions extends QRCodeOptions {
/**
* Define how much wide the quiet zone should be.
* Default: 4
*/
margin?: number;
/**
* Scale factor. A value of 1 means 1px per modules (black dots).
* Default: 4
*/
scale?: number;
color?: {
/**
* Color of dark module. Value must be in hex format (RGBA).
* Note: dark color should always be darker than color.light.
* Default: #000000ff
*/
dark?: string;
/**
* Color of light module. Value must be in hex format (RGBA).
* Default: #ffffffff
*/
light?: string;
};
}
export interface QRCodeSegment {
data: string;
mode: 'alphanumeric' | 'numeric';
}
export interface QRCode {
/**
* Bitmatrix class with modules data
*/
modules: any;
/**
* Calculated QR Code version
*/
version: number;
/**
* Error Correction Level
*/
errorCorrectionLevel: number;
/**
* Calculated Mask pattern
*/
maskPattern: any;
/**
* Generated segments
*/
segments: QRCodeSegment[];
}
/**
* Creates QR Code symbol and returns a qrcode object.
*/
export function create(text: string | QRCodeSegment[], options: QRCodeOptions): QRCode;
/**
* Draws qr code symbol to canvas.
*/
export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], callback: (error: Error) => void): void;
/**
* Draws qr code symbol to canvas.
*/
export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void;
/**
* Draws qr code symbol to canvas.
*/
export function toCanvas(text: string | QRCodeSegment[], callback: (error: Error, canvas: HTMLCanvasElement) => void): void;
/**
* Draws qr code symbol to canvas.
*/
export function toCanvas(text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void;
/**
* Draws qr code symbol to node canvas.
*/
export function toCanvas(canvas: any, text: string | QRCodeSegment[], callback: (error: Error) => void): void;
/**
* Draws qr code symbol to node canvas.
*/
export function toCanvas(canvas: any, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void;
/**
* Returns a Data URI containing a representation of the QR Code image.
*/
export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], callback: (error: Error, url: string) => void): void;
/**
* Returns a Data URI containing a representation of the QR Code image.
*/
export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void;
/**
* Returns a Data URI containing a representation of the QR Code image.
*/
export function toDataURL(text: string | QRCodeSegment[], callback: (error: Error, url: string) => void): void;
/**
* Returns a Data URI containing a representation of the QR Code image.
*/
export function toDataURL(text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void;
/**
* Returns a string representation of the QR Code.
* If choosen output format is svg it will returns a string containing xml code.
*/
export function toString(text: string | QRCodeSegment[], callback: (error: Error, string: string) => void): void;
/**
* Returns a string representation of the QR Code.
* If choosen output format is svg it will returns a string containing xml code.
*/
export function toString(text: string | QRCodeSegment[], options: QRCodeToStringOptions, callback: (error: Error, string: string) => void): void;
/**
* Saves QR Code to image file.
* If options.type is not specified, the format will be guessed from file extension.
* Recognized extensions are png, svg, txt.
*/
export function toFile(path: string, text: string | QRCodeSegment[], callback: (error: Error) => void): void;
/**
* Saves QR Code to image file.
* If options.type is not specified, the format will be guessed from file extension.
* Recognized extensions are png, svg, txt.
*/
export function toFile(path: string, text: string | QRCodeSegment[], options: QRCodeToFileOptions, callback: (error: Error) => void): void;
/**
* Writes QR Code image to stream. Only works with png format for now.
*/
export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], callback: (error: Error) => void): void;
/**
* Writes QR Code image to stream. Only works with png format for now.
*/
export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void;

17

qrcode/package.json
{
"name": "@types/qrcode",
"version": "0.0.2",
"version": "0.8.0",
"description": "TypeScript definitions for qrcode",
"license": "MIT",
"author": "York Yao <https://github.com/plantain-00/>",
"contributors": [
{
"name": "York Yao",
"url": "https://github.com/plantain-00/"
}
],
"main": "",

@@ -13,6 +18,8 @@ "repository": {

"scripts": {},
"dependencies": {},
"dependencies": {
"@types/node": "*"
},
"peerDependencies": {},
"typings": "index.d.ts",
"typesPublisherContentHash": "8e9bc8acf8d890caa572d668f624ee467c1108d6e3c08ce4a906f056f53664a4"
"typesPublisherContentHash": "cb526b27eb19d1d21c233c98f2ffed1847deb44bdcde33d34f1943ef49318a12",
"typeScriptVersion": "2.0"
}

@@ -8,12 +8,10 @@ # Installation

# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/qrcode
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qrcode
Additional Details
* Last updated: Sat, 05 Nov 2016 20:36:25 GMT
* File structure: Mixed
* Library Dependencies: none
* Module Dependencies: none
* Global values: QRCodeLib
* Last updated: Fri, 02 Jun 2017 13:25:33 GMT
* Dependencies: stream, node
* Global values: none
# Credits
These definitions were written by York Yao <https://github.com/plantain-00/>.
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