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.39

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

Listen for barcode scan results. Returns a handle that can be used to remove the listener.

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

Returns: any


addListener('rectangleDetected', ...)

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

Listen for rectangle (business card) detection results. Returns a handle that can be used to remove the listener.

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

Returns: any


removeAllListeners()

removeAllListeners() => any

Remove all listeners for this plugin.

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


Interfaces

PluginListenerHandle

| Prop | Type | | ------------ | ------------------------- | | remove | () => 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; /* * When true, run on-device text recognition (OCR) on the captured image and * return the recognized text in transcribedText. Defaults to false. * The OCR runs on the same image that is returned (the cropped badge region * when a rectangle/business card was detected, otherwise the full photo). * * Supported on both platforms, but the engine differs: iOS uses Vision (see * recognitionLevel / recognitionLanguages / automaticallyDetectLanguage), * while Android uses ML Kit's Latin-script recognizer (those options are ignored). / recognizeText?: boolean; /* * Accuracy/speed trade-off for OCR. Only used when recognizeText is true. * - 'accurate' (default): slower, neural-network based, best quality. Recommended for single captured photos. * - 'fast': quicker, lower quality. Prefer for high-throughput scenarios. * * iOS only. Ignored on Android — ML Kit has no equivalent speed/accuracy setting. * * @default 'accurate' / recognitionLevel?: TextRecognitionLevel; /* * Preferred OCR languages as an ordered priority list of BCP-47 codes * (e.g. ['en-US', 'ar-SA']). Only used when recognizeText is true. * When omitted, recognition falls back to English ('en-US'). * * The set of usable codes depends on the device's iOS version, because Apple's * Vision framework adds languages in successive request revisions. Passing a * code the running OS does not support has no effect on that device. * * | iOS | Newly available languages (cumulative) | * | ------ | ----------------------------------------------------------------------------------------------------------------------- | * | 13 | en-US | * | 14 | fr-FR, it-IT, de-DE, es-ES, pt-BR | * | 16 | zh-Hans, zh-Hant, yue-Hans, yue-Hant, ko-KR, ja-JP, ru-RU, uk-UA, th-TH, vi-VT | * | 17–18 | ar-SA, ar-AE (Arabic) and additional locales | * * Not supported even on the latest iOS: Hindi/Devanagari, Hebrew, and most * Indic/Southeast-Asian scripts. The definitive per-device list comes from * Apple's supportedRecognitionLanguages() at runtime. * * Tip: narrowing this list to the languages you actually expect generally * improves both accuracy and speed versus leaving it broad. * * Ignored when automaticallyDetectLanguage is true. * * iOS only. Ignored on Android, which always uses ML Kit's Latin-script * recognizer regardless of this value. * * @default ['en-US'] / recognitionLanguages?: string[]; /* * When true, let Vision automatically pick the recognition language(s) instead * of using recognitionLanguages. Only used when recognizeText is true. * * Requires iOS 16+. On older devices this flag is ignored and recognition * falls back to recognitionLanguages (or English). Auto-detection can only * choose among the languages the device's iOS actually supports (see the * table on recognitionLanguages) — it will not read unsupported scripts. * * Mutually exclusive with recognitionLanguages: when this is true, the * explicit language list is ignored. For a known, narrow set of languages an * explicit recognitionLanguages list usually yields better accuracy/speed * than auto-detection. * * iOS only. Ignored on Android, which always uses ML Kit's Latin-script * recognizer regardless of this value. * * @default false */ automaticallyDetectLanguage?: boolean; }

TextRecognitionLevel

OCR accuracy/speed trade-off, mapped to Apple Vision's VNRequestTextRecognitionLevel.

'fast' | 'accurate'

CapturePhotoResult

{ imageBase64: string; /** * On-device recognized text from the captured image, with lines joined by '\n'. * Present only when recognizeText was requested; empty string if nothing was recognized. */ transcribedText?: 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' |