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 🙏

© 2026 – Pkg Stats / Ryan Hefner

nano-scan

v0.0.5

Published

A browser scanning component based on zxing-wasm

Readme

NanoScan is a lightweight, high-performance web barcode and QR code scanner powered by zxing-wasm. Designed for maximum compatibility and flexibility, it supports all barcode types recognized by zxing-wasm and includes enhanced support for small or distant codes via canvas-based zooming.

✨ Features

  • 🔍 Supports All ZXing Formats Full access to zxing-wasm's decoding capabilities, including QR codes, EAN, Code 128, and more.

  • 🎥 Camera Zoom Fallback Automatically falls back to canvas-based digital zoom when native camera zoom APIs are not available — ideal for scanning small codes (~1cm).

  • ⚡️ Tiny & Easy to Integrate Minimal footprint and a clean API make NanoScan easy to drop into any web project.

Install

npm install nano-scan

Basic Usage

import NanoScan from 'nano-scan';

const nanoScan = new NanoScan({
  container: document.getElementById('camera-container'),
  resolution: {
    width: 1080,
    height: 1080,
  },
  fps: 30,
  zoom: 2,
  onScan: (result) => {
    console.log(result);
  },
  onError: (error) => {
    console.error(error);
  },
});

// Start scanning
nanoScan.startScan();

// Stop scanning
nanoScan.stopScan();

Class: NanoScan

Main class providing barcode/QR code scanning functionality.

Constructor

constructor(options: INanoScanOptions)

Parameters

options - Configuration object of type INanoScanOptions

Configuration Options (INanoScanOptions)

| Parameter | Type | Default | Description | | -------------- | ----------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------ | | container | HTMLElement \| null | null | Required. HTML container element for displaying camera preview | | resolution | { width: number, height: number } | { width: 1080, height: 1080 } | Camera resolution | | zxingOptions | ReaderOptions | { tryHarder: true, formats: ['QRCode'], maxNumberOfSymbols: 1 } | zxing-wasm reader options | | zxingWASMUrl | string | undefined | Custom zxing-wasm WebAssembly file URL | | marker | boolean | true | Whether to display scan result marker | | frame | boolean | true | Whether to display scan frame | | fps | number | 30 | Scanning frame rate | | zoom | number | 1 | Initial zoom level | | trick | boolean | true | Whether to use rotation trick for optimized scanning (helps with angled codes) | | onScan | (result: string) => void | noop | Callback function when a result is scanned | | onError | (error: Error) => void | noop | Callback function when an error occurs |

Methods

startScan()

Starts the scanning process.

async startScan(): Promise<void>

Initializes the camera, sets up canvases, and begins the scanning loop.

stopScan()

Stops the scanning process.

stopScan(): void

Stops the camera and scanning loop.

zoomIn(step?)

Zooms in the camera view.

zoomIn(step: number = 0.1): void

| Parameter | Type | Default | Description | | --------- | -------- | ------- | -------------------- | | step | number | 0.1 | Amount to zoom in by |

zoomOut(step?)

Zooms out the camera view.

zoomOut(step: number = 0.1): void

| Parameter | Type | Default | Description | | --------- | -------- | ------- | --------------------- | | step | number | 0.1 | Amount to zoom out by |

zoomTo(zoom)

Zooms the camera view to a specific level.

zoomTo(zoom: number): void

| Parameter | Type | Description | | --------- | -------- | ----------------- | | zoom | number | Zoom level to set |

toggleTorch(open)

Toggles the camera's torch (flashlight) on or off, if supported by the device.

toggleTorch(bool: boolean): void

| Parameter | Type | Description | | --------- | -------- | ----------------- | | bool | boolean | torch (flashlight) on or off |

License

MIT