0.0.2 • Published 2 years ago

boru-barcode-scanner v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

boru-barcode-scanner

Barcode scanner with camera zoom

Install

npm install boru-barcode-scanner
npx cap sync

API

startScan(...)

startScan(options?: StartScanOptions | undefined) => Promise<void>

Start scanning for barcodes.

Only available on Android and iOS.

ParamType
optionsStartScanOptions

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.

ParamType
optionsReadBarcodesFromImageOptions

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.

ParamType
zoomRatioany

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.

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

ParamType
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

PropTypeDescriptionSince
formatsBarcodeFormat[]Improve the speed of the barcode scanner by configuring the barcode formats to scan for.0.0.1
lensFacingLensFacingConfigure the camera (front or back) to use.0.0.1

ReadBarcodesFromImageResult

PropTypeDescriptionSince
barcodesBarcode[]The detected barcodes.0.0.1

Barcode

PropTypeDescriptionSince
bytesnumber[]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
displayValuestringThe barcode value in a human readable format.0.0.1
formatBarcodeFormatThe barcode format.0.0.1
rawValuestringThe barcode value in a machine readable format.0.0.1
valueTypeBarcodeValueTypeThe barcode value type.0.0.1

ReadBarcodesFromImageOptions

PropTypeDescriptionSince
formatsBarcodeFormat[]Improve the speed of the barcode scanner by configuring the barcode formats to scan for.0.0.1
pathstringThe local path to the image file.0.0.1

IsSupportedResult

PropTypeDescriptionSince
supportedbooleanWhether or not the barcode scanner is supported.0.0.1

IsTorchEnabledResult

PropTypeDescriptionSince
enabledbooleanWhether or not the torch is enabled.0.0.1

IsTorchAvailableResult

PropTypeDescriptionSince
availablebooleanWhether or not the torch is available.0.0.1

PermissionStatus

PropTypeSince
cameraCameraPermissionState0.0.1

PluginListenerHandle

PropType
remove() => Promise<void>

BarcodeScannedEvent

PropTypeDescriptionSince
barcodeBarcodeA detected barcode.0.0.1

ScanErrorEvent

PropTypeDescriptionSince
messagestringThe error message.0.0.1

Type Aliases

CameraPermissionState

PermissionState | 'limited'

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

Enums

BarcodeFormat

MembersValueDescriptionSince
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

MembersValueSince
Front'FRONT'0.0.1
Back'BACK'0.0.1

BarcodeValueType

MembersValueSince
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
0.0.2

2 years ago

0.0.1

2 years ago