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

@uni/scan

v1.0.3

Published

Readme

scan

npm

Opens the code scanning interface in the app to scan the code.

Supported

Install

$ npm install @uni/scan --save

or

$ npm install @uni/apis --save

示例

import scan from '@uni/scan';

scan({
  scanType: ['qrCode','barCode'],
  success (res) {
    console.log(res.result)
  },
  fail (res) {
    console.log(res)
  }
});

// promise
scan({
  scanType: ['qrCode','barCode'],
}).then(res => {
  console.log(res.result)
});

You can also import from big package:

import { scan } from '@uni/apis';

Function

scan(options)

Property

| Property | Type | Description | Required | Default | | --- | --- | --- | --- | --- | | options | object  | | ✘ | - | | options.success | Function  | The callback function for a successful API call | ✘ | - | | options.fail | Function  | The callback function for a failed API call | ✘ | - | | options.complete | Function  | The callback function used when the API call completed | ✘ | - |

Valid values of object.scanType

| Value | Description | Supported | | --- | --- | --- | | barCode | Barcode | | | qrCode | QR code | | | dmCode | Data Matrix code | | | pdf417Code | PDF417 barcode | | | narrowCode | Narrow bar QR code | | | hmCode | Heterogeneous code | |

Non general parameters

| Property | Type | Description | Required | Default | Supported | | --- | --- | --- | --- | --- | -- | | options.hideAlbum | Boolean  | Indicates whether to allow to scan code with camera only | ✘ | false | | | options.scanType | Array<string>  | Type of code to scan | ✘ | ['barCode', 'qrCode'] | |

object.success callback function

Object res

| Property | Type | Description | | --- | --- | --- | | result | string | Content of code to scan |

Non general parameters

| Property | Type | Description | Supported | | --- | --- | --- | --- | | charSet | string | Character set of code to scan | | | path | string | If the scanned code is the QR code of the current Mini Program, this field is returned, and the content is the path carried by the QR code. | | | scanType | string | Type of code to scan | | | rawData | string | Base64 encoded raw data | | | imageChannel | string | source | | | code | string | Scan data | | | qrCode | string | Return QR code data when scanning QR code | | | barCode | string | Return barcode data when scanning barcode. | |