boru-barcode-scanner v0.0.2
boru-barcode-scanner
Barcode scanner with camera zoom
Install
npm install boru-barcode-scanner
npx cap sync
API
startScan(...)
stopScan()
readBarcodesFromImage(...)
isSupported()
setZoom(...)
enableTorch()
disableTorch()
toggleTorch()
isTorchEnabled()
isTorchAvailable()
checkPermissions()
requestPermissions()
addListener('barcodeScanned', ...)
addListener('scanError', ...)
removeAllListeners()
- Interfaces
- Type Aliases
- Enums
startScan(...)
startScan(options?: StartScanOptions | undefined) => Promise<void>
Start scanning for barcodes.
Only available on Android and iOS.
Param | Type |
---|---|
options | StartScanOptions |
Since: 0.0.1
stopScan()
stopScan() => Promise<void>
Stop scanning for barcodes.
Only available on Android and iOS.
Since: 0.0.1
readBarcodesFromImage(...)
readBarcodesFromImage(options: ReadBarcodesFromImageOptions) => Promise<ReadBarcodesFromImageResult>
Read barcodes from an image.
Only available on Android and iOS.
Param | Type |
---|---|
options | ReadBarcodesFromImageOptions |
Returns: Promise<ReadBarcodesFromImageResult>
Since: 0.0.1
isSupported()
isSupported() => Promise<IsSupportedResult>
Returns whether or not the barcode scanner is supported.
Available on Android and iOS.
Returns: Promise<IsSupportedResult>
Since: 0.0.1
setZoom(...)
setZoom(zoomRatio: any) => Promise<void>
Enable zoom feature during a scan session.
Only available on Android and iOS.
Param | Type |
---|---|
zoomRatio | any |
Since: 0.0.1
enableTorch()
enableTorch() => Promise<void>
Enable camera's torch (flash) during a scan session.
Only available on Android and iOS.
Since: 0.0.1
disableTorch()
disableTorch() => Promise<void>
Disable camera's torch (flash) during a scan session.
Only available on Android and iOS.
Since: 0.0.1
toggleTorch()
toggleTorch() => Promise<void>
Toggle camera's torch (flash) during a scan session.
Only available on Android and iOS.
Since: 0.0.1
isTorchEnabled()
isTorchEnabled() => Promise<IsTorchEnabledResult>
Returns whether or not the camera's torch (flash) is enabled.
Only available on Android and iOS.
Returns: Promise<IsTorchEnabledResult>
Since: 0.0.1
isTorchAvailable()
isTorchAvailable() => Promise<IsTorchAvailableResult>
Returns whether or not the camera's torch (flash) is available.
Only available on Android and iOS.
Returns: Promise<IsTorchAvailableResult>
Since: 0.0.1
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Check camera permission.
Only available on Android and iOS.
Returns: Promise<PermissionStatus>
Since: 0.0.1
requestPermissions()
requestPermissions() => Promise<PermissionStatus>
Request camera permission.
Only available on Android and iOS.
Returns: Promise<PermissionStatus>
Since: 0.0.1
addListener('barcodeScanned', ...)
addListener(eventName: 'barcodeScanned', listenerFunc: (event: BarcodeScannedEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when a barcode is scanned.
Available on Android and iOS.
Param | Type |
---|---|
eventName | 'barcodeScanned' |
listenerFunc | (event: BarcodeScannedEvent) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
addListener('scanError', ...)
addListener(eventName: 'scanError', listenerFunc: (event: ScanErrorEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when an error occurs during the scan.
Available on Android and iOS.
Param | Type |
---|---|
eventName | 'scanError' |
listenerFunc | (event: ScanErrorEvent) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
removeAllListeners()
removeAllListeners() => Promise<void>
Remove all listeners for this plugin.
Since: 0.0.1
Interfaces
StartScanOptions
Prop | Type | Description | Since |
---|---|---|---|
formats | BarcodeFormat[] | Improve the speed of the barcode scanner by configuring the barcode formats to scan for. | 0.0.1 |
lensFacing | LensFacing | Configure the camera (front or back) to use. | 0.0.1 |
ReadBarcodesFromImageResult
Prop | Type | Description | Since |
---|---|---|---|
barcodes | Barcode[] | The detected barcodes. | 0.0.1 |
Barcode
Prop | Type | Description | Since |
---|---|---|---|
bytes | number[] | Raw bytes as it was encoded in the barcode. | 0.0.1 |
cornerPoints | [number, number, number, number, number, number, number, number] | The four corner points of the barcode in clockwise order starting with top-left. This property is currently only supported by the startScan(...) method. | 0.0.1 |
displayValue | string | The barcode value in a human readable format. | 0.0.1 |
format | BarcodeFormat | The barcode format. | 0.0.1 |
rawValue | string | The barcode value in a machine readable format. | 0.0.1 |
valueType | BarcodeValueType | The barcode value type. | 0.0.1 |
ReadBarcodesFromImageOptions
Prop | Type | Description | Since |
---|---|---|---|
formats | BarcodeFormat[] | Improve the speed of the barcode scanner by configuring the barcode formats to scan for. | 0.0.1 |
path | string | The local path to the image file. | 0.0.1 |
IsSupportedResult
Prop | Type | Description | Since |
---|---|---|---|
supported | boolean | Whether or not the barcode scanner is supported. | 0.0.1 |
IsTorchEnabledResult
Prop | Type | Description | Since |
---|---|---|---|
enabled | boolean | Whether or not the torch is enabled. | 0.0.1 |
IsTorchAvailableResult
Prop | Type | Description | Since |
---|---|---|---|
available | boolean | Whether or not the torch is available. | 0.0.1 |
PermissionStatus
Prop | Type | Since |
---|---|---|
camera | CameraPermissionState | 0.0.1 |
PluginListenerHandle
Prop | Type |
---|---|
remove | () => Promise<void> |
BarcodeScannedEvent
Prop | Type | Description | Since |
---|---|---|---|
barcode | Barcode | A detected barcode. | 0.0.1 |
ScanErrorEvent
Prop | Type | Description | Since |
---|---|---|---|
message | string | The error message. | 0.0.1 |
Type Aliases
CameraPermissionState
PermissionState | 'limited'
PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
Enums
BarcodeFormat
Members | Value | Description | Since |
---|---|---|---|
Aztec | 'AZTEC' | Only available on Android and iOS. | 0.0.1 |
Codabar | 'CODABAR' | Only available on Android and iOS. | 0.0.1 |
Code39 | 'CODE_39' | Only available on Android and iOS. | 0.0.1 |
Code93 | 'CODE_93' | Only available on Android and iOS. | 0.0.1 |
Code128 | 'CODE_128' | Only available on Android and iOS. | 0.0.1 |
DataMatrix | 'DATA_MATRIX' | Only available on Android and iOS. | 0.0.1 |
Ean8 | 'EAN_8' | Only available on Android and iOS. | 0.0.1 |
Ean13 | 'EAN_13' | Only available on Android and iOS. | 0.0.1 |
Itf | 'ITF' | Only available on Android and iOS. | 0.0.1 |
Pdf417 | 'PDF_417' | Only available on Android and iOS. | 0.0.1 |
QrCode | 'QR_CODE' | Only available on Android and iOS. | 0.0.1 |
UpcA | 'UPC_A' | Only available on Android and iOS. | 0.0.1 |
UpcE | 'UPC_E' | Only available on Android and iOS. | 0.0.1 |
LensFacing
Members | Value | Since |
---|---|---|
Front | 'FRONT' | 0.0.1 |
Back | 'BACK' | 0.0.1 |
BarcodeValueType
Members | Value | Since |
---|---|---|
CalendarEvent | 'CALENDAR_EVENT' | 0.0.1 |
ContactInfo | 'CONTACT_INFO' | 0.0.1 |
DriversLicense | 'DRIVERS_LICENSE' | 0.0.1 |
Email | 'EMAIL' | 0.0.1 |
Geo | 'GEO' | 0.0.1 |
Isbn | 'ISBN' | 0.0.1 |
Phone | 'PHONE' | 0.0.1 |
Product | 'PRODUCT' | 0.0.1 |
Sms | 'SMS' | 0.0.1 |
Text | 'TEXT' | 0.0.1 |
Url | 'URL' | 0.0.1 |
Wifi | 'WIFI' | 0.0.1 |
Unknown | 'UNKNOWN' | 0.0.1 |