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

@scr2em/capacitor-scanner

v6.0.33

Published

scan codes

Readme

Capacitor Scanner

scan codes

Install

npm install capacitor-scanner
npx cap sync

API

start(...)

start(options?: StartOptions | undefined) => any

Start the camera preview with optional barcode and object detection.

| Param | Type | Description | | ------------- | ----------------------------------------------------- | ---------------------------------------------------- | | options | StartOptions | - Configuration options for the camera and detection |

Returns: any


stop()

stop() => any

Stop the camera preview and all detection.

Returns: any


openSettings()

openSettings() => any

Returns: any


capturePhoto(...)

capturePhoto(options?: CapturePhotoOptions | undefined) => any

| Param | Type | | ------------- | ------------------------------------------------------------------- | | options | CapturePhotoOptions |

Returns: any


checkPermissions()

checkPermissions() => any

Returns: any


requestPermissions()

requestPermissions() => any

Returns: any


flipCamera()

flipCamera() => any

Returns: any


toggleFlash()

toggleFlash() => any

Returns: any


addListener('barcodeScanned', ...)

addListener(event: 'barcodeScanned', listenerFunc: (result: BarcodeScannedEvent) => void) => any

| Param | Type | | ------------------ | ---------------------------------------------------------------------------------------- | | event | 'barcodeScanned' | | listenerFunc | (result: BarcodeScannedEvent) => void |

Returns: any


addListener('rectangleDetected', ...)

addListener(event: 'rectangleDetected', listenerFunc: (result: RectangleDetectedEvent) => void) => any

| Param | Type | | ------------------ | ---------------------------------------------------------------------------------------------- | | event | 'rectangleDetected' | | listenerFunc | (result: RectangleDetectedEvent) => void |

Returns: any


removeAllListeners()

removeAllListeners() => any

Returns: any


enableObjectDetection(...)

enableObjectDetection(options?: ObjectDetectionOptions | undefined) => any

Enable object detection (business card). This will start detecting business cards.

| Param | Type | Description | | ------------- | ------------------------------------------------------------------------- | --------------------------------------------- | | options | ObjectDetectionOptions | - Optional configuration for object detection |

Returns: any


disableObjectDetection()

disableObjectDetection() => any

Disable object detection. This will stop detecting business cards.

Returns: any


enableBarcodeDetection(...)

enableBarcodeDetection(options?: BarcodeDetectionOptions | undefined) => any

Enable barcode detection. This will start detecting barcodes.

| Param | Type | Description | | ------------- | --------------------------------------------------------------------------- | ---------------------------------------------- | | options | BarcodeDetectionOptions | - Optional configuration for barcode detection |

Returns: any


disableBarcodeDetection()

disableBarcodeDetection() => any

Disable barcode detection. This will stop detecting barcodes and clear cached barcodes.

Returns: any


zoom(...)

zoom(options: ZoomOptions) => any

Set the camera zoom level.

| Param | Type | Description | | ------------- | --------------------------------------------------- | ---------------------------------------------------- | | options | ZoomOptions | - The zoom options containing the level (1, 2, or 3) |

Returns: any


Type Aliases

StartOptions

{ /** * Barcode formats to detect when barcodeDetection is enabled. / formats?: BarcodeFormat[]; /* * Camera direction to use. Defaults to 'BACK'. / cameraDirection?: 'BACK' | 'FRONT'; /* * Enable barcode detection on start. Defaults to false. * When enabled, the camera will automatically detect barcodes and emit 'barcodeScanned' events. / barcodeDetection?: boolean; /* * Whether to show the highlight overlay for detected barcodes. Defaults to false. * Only applies when barcodeDetection is true. / barcodeHighlight?: boolean; /* * Enable object detection (business card) on start. Defaults to false. * When enabled, the camera will automatically detect business cards and emit 'rectangleDetected' events. / objectDetection?: boolean; /* * Whether to show the highlight overlay for detected business cards. Defaults to true. * Only applies when objectDetection is true. / objectHighlight?: boolean; /* * Minimum interval in seconds between consecutive 'rectangleDetected' events. * Only applies when objectDetection is true. * Defaults to 0 (no throttling beyond initial stability check). / rectangleEmitIntervalSeconds?: number; /* * Optional regex pattern to filter scanned barcodes. * If provided, only barcodes matching this pattern will be reported. / regex?: string; /* * Optional regex flags (e.g., 'i' for case-insensitive, 'm' for multiline). / regexFlags?: string; /* * Cooldown in seconds after any detection event when both barcode and object detection are enabled. * After a barcode or rectangle is emitted, ALL detection pauses for this duration. * When set, barcode dedup TTL becomes 2x this value and rectangle emit interval becomes 2x this value. * Only applies when both barcodeDetection and objectDetection are true. * Defaults to 0 (no throttle, both detections run simultaneously). */ detectionThrottleSeconds?: number; }

CapturePhotoOptions

{ /** * The desired quality of the captured image, expressed as a value between 0.0 (lowest quality, smallest file size) * and 1.0 (highest quality, largest file size). Defaults to 1.0. * This parameter directly influences the compression level of the resulting JPEG image. */ qualityRatio?: number; }

CapturePhotoResult

{ imageBase64: string }

PermissionsResult

{ camera: 'prompt' | 'denied' | 'granted' }

FlashResult

{ enabled: boolean }

BarcodeScannedEvent

{ scannedCode: string; format: string }

RectangleDetectedEvent

{ detected: true }

ObjectDetectionOptions

{ /** * Whether to show the highlight overlay for detected business cards. * Defaults to true. / showHighlight?: boolean, /* * Minimum interval in seconds between consecutive 'rectangleDetected' events. * After an event is emitted, no new events will be emitted until this interval passes. * Set to 0 to emit events as soon as stability is detected. * Defaults to 0 (no throttling beyond initial stability check). */ emitIntervalSeconds?: number }

BarcodeDetectionOptions

{ /** * Whether to show the highlight overlay for detected barcodes. * Defaults to false. */ showHighlight?: boolean; }

ZoomOptions

{ /** * The zoom level to set. Must be 1, 2, or 3. * - 1 = 1.0x (no zoom) * - 2 = 2.0x * - 3 = 3.0x */ level: 1 | 2 | 3; }

ZoomResult

{ level: number }

Enums

BarcodeFormat

| Members | Value | | ---------------- | -------------------------- | | Aztec | 'AZTEC' | | Code39 | 'CODE_39' | | Code93 | 'CODE_93' | | Code128 | 'CODE_128' | | DataMatrix | 'DATA_MATRIX' | | Ean8 | 'EAN_8' | | Ean13 | 'EAN_13' | | Itf14 | 'ITF14' | | Pdf417 | 'PDF_417' | | QrCode | 'QR_CODE' | | UpcE | 'UPC_E' |