npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

qrlite

v1.1.0

Published

QRLite is QRCode(8bit mode) generator written in TypeScript only.

Downloads

17

Readme

QRLite

MIT License npm browser nodejs

日本語はこちら

QRLite is QRCode(8bit mode) generator written in TypeScript only.

QRlite can output QRLite bitmap canvas, text, and Monochrome bitmap.

Install

npm i qrlite

Sample

Output Bitmap(Node.js sample)

const QRLite = require( 'qrlite' );
function OutputBitmapFile( name, canvas, frame ) {
	if ( frame === undefined ) { frame = 4; }
	var fs = require('fs');
	var buf = Buffer.from( canvas.outputBitmapByte( frame ) );
	fs.writeFileSync( name, buf );
}
OutputBitmapFile( 'test.bmp', QRLite.convert( 'test' ) );

Browser sample

<script src="./qrlite.js"></script>
<script>console.log(QRLite);</script>

QRCode WebComponents(Browser sample2)

https://github.com/HirokiMiyaoka/QRCodeComponent

QRCodeComponent is QRCode generate and draw Webcomponents uses QRLite.

TypeScript sample

import * as QRLite from 'qrlite';

Debug

const qr = new QRLite.Generator();

// Set level.
qr.setLevel( 'Q' );

// Set data.
qr.setData( 'test' );

// datacode[ 0 ] = Data block, datacode[ 1 ] = EC Block
const datacode = qr.createDataCode();

// Raw QR Code.
qr.drawData( datacode[ 0 ], datacode[ 1 ] );
const rawcanvas = qr.get();

// Get masked canvases.(masked[ 0-7 ] = QRLite.Canvas)
const masked = qr.createMaskedQRCode();

// Print QRCode points.
// console.log( qr.evaluateQRCode( masked ) );

// Select mask number.
const masknum = qr.selectQRCode( masked );

// QR Code.
const canvas = masked[ masknum ];

// Output to console.
canvas.print();

Black = 1 or true, White = 0 or false.

QRLite.convert(data: string, option: QRLiteConvertOption): QRLiteBitCanvas

type QRLiteLevel = 'L' | 'M' | 'Q' | 'H';
interface QRLiteConvertOption {
    level?: QRLiteLevel;
    version?: number;
    mask?: number;
}

QRLite.Generator

convert(datastr: string, option?: QRLiteConvertOption): QRLiteBitCanvas

get(): QRLiteBitCanvas

getLevel(): QRLiteLevel

setLevel(level: QRLiteLevel): QRLiteLevel

getVersion() => number

setRating(rating?: QRLiteRating): void

interface QRLiteRating {
    calc: (canvas: QRLiteBitCanvas) => number;
}

setData( data: string | Uint8Array ) => UInt8Array

createDataCode() => [ 0: UInt8Array, 1: UInt8Array ]

[ 0 ] ... Data code

[ 1 ] ... EC code.

drawData( data: Uint8Array, ec: Uint8Array )

createMaskedQRCode(): QRLiteBitCanvas[]

Return masked QR code.

Mask has 8 types.

selectQRCode(qrcodes: QRLiteBitCanvas[]): number

evaluateQRCode(qrcodes: QRLiteBitCanvas[]): number[]

QRLiteBitCanvas

clone() => QRLite.BitCanvas

getPixel( x: number, y: number ) => boolean|undefined

getPixels() => <boolean|undefined>[]

drawPixel( x: number, y: number, black: boolean ) => this

reverse( func: ( i: number, j: number ) => boolean, mask: boolean[] ) => this

isTransparentPixel( x: number, y: number ) => boolean

drawQRByte( byte: Uint8Array, cursor?: { x: number, y: number, up: boolean, right: boolean } ) => { x: number, y: number, up: boolean, right: boolean }

sprint( option?: { white?: string, black?: string, none?: string, newline?: string } )

print( white: string = '██', black: string = ' ', none: string = '--' )

outputBitmapByte( frame: number = 4 ) => number[]

Write code Buffer.from( canvas.outputBitmapByte( frame ) ) if you want to get Buffer.

Test

Build

npm run build

Run

All test.

npm run test

Options.

npm run test -- OPTION FILES...
  • OPTION
    • --binary
    • -b
      • Binary mode.
    • --debug
    • -d
      • Text mode.
  • FILES
    • Set test dir.
      • npm run test -- 0000_1_H

Add

Base

test/
  NNNN_VERSION_LEVEL/ ... Test case
    test.txt          ... QRCode text.
    sample.png        ... Sample for human.
    sample.bmp        ... Binary mode sample.
    sample.txt        ... Text mode sample.
  • NNNN
    • Test number. Start 0000.
  • VERSION
    • QRCode version. ( 140 )
  • LEVEL
    • QRCode level. ( L M Q H )
  • test.txt
    • QRCode data.
  • sample.png
    • Only sample.

Binary

Binary mode test use Microsoft monochrome bitmap. You create min QRCode and rename sample.bmp .

Text

Text mode test use sample.txt .

This answer set White = [ ], Black = [██].

Other