Skip to content

@tauri-apps/plugin-barcode-scanner

Scan QR codes, EAN-13 and other kinds of barcodes with the device’s camera on Android and iOS.

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L22

The barcode symbologies that can be scanned, or used to restrict a scan via ScanOptions.formats.

Aztec: "AZTEC";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L70

Aztec code, a two-dimensional matrix barcode often used on tickets and boarding passes.

Codabar: "CODABAR";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L62

Codabar, a numeric barcode commonly used by libraries and blood banks.

Not supported on iOS.

Code128: "CODE_128";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L56

Code 128, a high-density alphanumeric barcode used in shipping and packaging.

Code39: "CODE_39";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L48

Code 39, an alphanumeric barcode used in logistics and inventory tracking.

Code93: "CODE_93";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L52

Code 93, a compact alphanumeric barcode similar to Code 39.

DataMatrix: "DATA_MATRIX";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L74

Data Matrix, a two-dimensional matrix barcode used to encode small amounts of data.

EAN13: "EAN_13";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L44

EAN-13, a 13-digit numeric barcode used worldwide on retail products.

EAN8: "EAN_8";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L40

EAN-8, an 8-digit numeric barcode used on small retail packaging.

GS1DataBar: "GS1_DATA_BAR";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L84

GS1 DataBar, a compact barcode used to mark variable-measure items such as fresh food.

Not supported on Android. Requires iOS 15.4+

GS1DataBarExpanded: "GS1_DATA_BAR_EXPANDED";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L96

The expanded variant of Format.GS1DataBar, capable of encoding additional data such as weight.

Not supported on Android. Requires iOS 15.4+

GS1DataBarLimited: "GS1_DATA_BAR_LIMITED";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L90

The limited variant of Format.GS1DataBar, encoding fewer digits in a smaller symbol.

Not supported on Android. Requires iOS 15.4+

ITF: "ITF";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L66

ITF (Interleaved 2 of 5), a numeric barcode encoding an even number of digits.

PDF417: "PDF_417";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L78

PDF417, a stacked linear barcode used on IDs, boarding passes and shipping labels.

QRCode: "QR_CODE";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L26

QR code, a two-dimensional matrix barcode.

UPC_A: "UPC_A";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L32

UPC-A, a 12-digit numeric barcode commonly used on retail products in North America.

Not supported on iOS.

UPC_E: "UPC_E";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L36

UPC-E, a compressed 6-digit variant of UPC-A used on small packaging.

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L120

The result of a successful scan call.

Property Type Description Defined in
bounds unknown The bounding box of the scanned barcode within the camera frame, when reported by the platform. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L132
content string The decoded content of the barcode. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L124
format Format The format of the scanned barcode. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L128

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L102

Options to configure a scan call.

Property Type Description Defined in
cameraDirection? "back" | "front" Which camera to use for scanning. Defaults to back. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L106
formats? Format[] The barcode formats to scan for. Defaults to all supported formats. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L110
windowed? boolean Whether to show the camera in a small window instead of taking over the whole screen. Defaults to false. Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L114

type PermissionState = "granted" | "denied" | "prompt" | "prompt-with-rationale";

Source: undefined

function cancel(): Promise<void>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L166

Cancel the current scan process.

Promise<void>

import { cancel } from '@tauri-apps/plugin-barcode-scanner';
await cancel();

2.0.0


function checkPermissions(): Promise<PermissionState>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L183

Get the current state of the camera permission.

Promise<PermissionState>

A promise resolving to the current state of the camera permission.

import { checkPermissions } from '@tauri-apps/plugin-barcode-scanner';
const permissionState = await checkPermissions();

2.0.0


function openAppSettings(): Promise<void>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L220

Open application settings. Useful if permission was denied and the user must manually enable it.

Promise<void>

import { openAppSettings } from '@tauri-apps/plugin-barcode-scanner';
await openAppSettings();

2.0.0


function requestPermissions(): Promise<PermissionState>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L202

Request permissions to use the camera.

Promise<PermissionState>

A promise resolving to the new state of the camera permission.

import { requestPermissions } from '@tauri-apps/plugin-barcode-scanner';
const permissionState = await requestPermissions();

2.0.0


function scan(options?): Promise<Scanned>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/guest-js/index.ts#L150

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.

Parameter Type Description
options? ScanOptions Configuration for the scan.

Promise<Scanned>

A promise resolving to the scanned barcode.

import { scan, Format } from '@tauri-apps/plugin-barcode-scanner';
const scanned = await scan({ windowed: true, formats: [Format.QRCode] });

2.0.0


© 2026 Tauri Contributors. CC-BY / MIT