@tauri-apps/plugin-barcode-scanner
Scan QR codes, EAN-13 and other kinds of barcodes with the device’s camera on Android and iOS.
Functions
Section titled “Functions”cancel()
Section titled “cancel()”function cancel(): Promise<void>;Defined in: plugins/barcode-scanner/guest-js/index.ts:166
Cancel the current scan process.
Example
Section titled “Example”import { cancel } from '@tauri-apps/plugin-barcode-scanner';
await cancel();Returns
Section titled “Returns”2.0.0
checkPermissions()
Section titled “checkPermissions()”function checkPermissions(): Promise<PermissionState>;Defined in: plugins/barcode-scanner/guest-js/index.ts:183
Get the current state of the camera permission.
Example
Section titled “Example”import { checkPermissions } from '@tauri-apps/plugin-barcode-scanner';
const permissionState = await checkPermissions();Returns
Section titled “Returns”A promise resolving to the current state of the camera permission.
2.0.0
openAppSettings()
Section titled “openAppSettings()”function openAppSettings(): Promise<void>;Defined in: plugins/barcode-scanner/guest-js/index.ts:220
Open application settings. Useful if permission was denied and the user must manually enable it.
Example
Section titled “Example”import { openAppSettings } from '@tauri-apps/plugin-barcode-scanner';
await openAppSettings();Returns
Section titled “Returns”2.0.0
requestPermissions()
Section titled “requestPermissions()”function requestPermissions(): Promise<PermissionState>;Defined in: plugins/barcode-scanner/guest-js/index.ts:202
Request permissions to use the camera.
Example
Section titled “Example”import { requestPermissions } from '@tauri-apps/plugin-barcode-scanner';
const permissionState = await requestPermissions();Returns
Section titled “Returns”A promise resolving to the new state of the camera permission.
2.0.0
scan()
Section titled “scan()”function scan(options?: ScanOptions): Promise<Scanned>;Defined in: plugins/barcode-scanner/guest-js/index.ts:150
Start scanning, opening the device’s camera. The returned promise resolves once a barcode matching the given options has been scanned, or rejects if the scan is cancelled.
Example
Section titled “Example”import { scan, Format } from '@tauri-apps/plugin-barcode-scanner';
const scanned = await scan({ windowed: true, formats: [Format.QRCode] });Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? |
ScanOptions |
Configuration for the scan. |
Returns
Section titled “Returns”A promise resolving to the scanned barcode.
2.0.0
Enumerations
Section titled “Enumerations”Format
Section titled “Format”Defined in: plugins/barcode-scanner/guest-js/index.ts:22
The barcode symbologies that can be scanned, or used to restrict a scan via ScanOptions.formats.
Enumeration Members
Section titled “Enumeration Members”| Enumeration Member | Value | Description | Defined in |
|---|---|---|---|
Aztec |
"AZTEC" |
Aztec code, a two-dimensional matrix barcode often used on tickets and boarding passes. | plugins/barcode-scanner/guest-js/index.ts:70 |
Codabar |
"CODABAR" |
Codabar, a numeric barcode commonly used by libraries and blood banks. Not supported on iOS. | plugins/barcode-scanner/guest-js/index.ts:62 |
Code128 |
"CODE_128" |
Code 128, a high-density alphanumeric barcode used in shipping and packaging. | plugins/barcode-scanner/guest-js/index.ts:56 |
Code39 |
"CODE_39" |
Code 39, an alphanumeric barcode used in logistics and inventory tracking. | plugins/barcode-scanner/guest-js/index.ts:48 |
Code93 |
"CODE_93" |
Code 93, a compact alphanumeric barcode similar to Code 39. | plugins/barcode-scanner/guest-js/index.ts:52 |
DataMatrix |
"DATA_MATRIX" |
Data Matrix, a two-dimensional matrix barcode used to encode small amounts of data. | plugins/barcode-scanner/guest-js/index.ts:74 |
EAN13 |
"EAN_13" |
EAN-13, a 13-digit numeric barcode used worldwide on retail products. | plugins/barcode-scanner/guest-js/index.ts:44 |
EAN8 |
"EAN_8" |
EAN-8, an 8-digit numeric barcode used on small retail packaging. | plugins/barcode-scanner/guest-js/index.ts:40 |
GS1DataBar |
"GS1_DATA_BAR" |
GS1 DataBar, a compact barcode used to mark variable-measure items such as fresh food. Not supported on Android. Requires iOS 15.4+ | plugins/barcode-scanner/guest-js/index.ts:84 |
GS1DataBarExpanded |
"GS1_DATA_BAR_EXPANDED" |
The expanded variant of Format.GS1DataBar, capable of encoding additional data such as weight. Not supported on Android. Requires iOS 15.4+ | plugins/barcode-scanner/guest-js/index.ts:96 |
GS1DataBarLimited |
"GS1_DATA_BAR_LIMITED" |
The limited variant of Format.GS1DataBar, encoding fewer digits in a smaller symbol. Not supported on Android. Requires iOS 15.4+ | plugins/barcode-scanner/guest-js/index.ts:90 |
ITF |
"ITF" |
ITF (Interleaved 2 of 5), a numeric barcode encoding an even number of digits. | plugins/barcode-scanner/guest-js/index.ts:66 |
PDF417 |
"PDF_417" |
PDF417, a stacked linear barcode used on IDs, boarding passes and shipping labels. | plugins/barcode-scanner/guest-js/index.ts:78 |
QRCode |
"QR_CODE" |
QR code, a two-dimensional matrix barcode. | plugins/barcode-scanner/guest-js/index.ts:26 |
UPC_A |
"UPC_A" |
UPC-A, a 12-digit numeric barcode commonly used on retail products in North America. Not supported on iOS. | plugins/barcode-scanner/guest-js/index.ts:32 |
UPC_E |
"UPC_E" |
UPC-E, a compressed 6-digit variant of UPC-A used on small packaging. | plugins/barcode-scanner/guest-js/index.ts:36 |
Interfaces
Section titled “Interfaces”Scanned
Section titled “Scanned”Defined in: plugins/barcode-scanner/guest-js/index.ts:120
The result of a successful scan call.
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
bounds |
unknown |
The bounding box of the scanned barcode within the camera frame, when reported by the platform. | plugins/barcode-scanner/guest-js/index.ts:132 |
content |
string |
The decoded content of the barcode. | plugins/barcode-scanner/guest-js/index.ts:124 |
format |
Format |
The format of the scanned barcode. | plugins/barcode-scanner/guest-js/index.ts:128 |
ScanOptions
Section titled “ScanOptions”Defined in: plugins/barcode-scanner/guest-js/index.ts:102
Options to configure a scan call.
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
cameraDirection? |
"back" | "front" |
Which camera to use for scanning. Defaults to back. |
plugins/barcode-scanner/guest-js/index.ts:106 |
formats? |
Format[] |
The barcode formats to scan for. Defaults to all supported formats. | plugins/barcode-scanner/guest-js/index.ts:110 |
windowed? |
boolean |
Whether to show the camera in a small window instead of taking over the whole screen. Defaults to false. |
plugins/barcode-scanner/guest-js/index.ts:114 |
Type Aliases
Section titled “Type Aliases”PermissionState
Section titled “PermissionState”type PermissionState = "granted" | "denied" | "prompt" | "prompt-with-rationale";Defined in: @tauri-apps/api/core.d.ts:179
© 2026 Tauri Contributors. CC-BY / MIT