barcode4nodejs
Advanced tools
Comparing version 9.6.42 to 9.6.43
@@ -71,2 +71,3 @@ export enum formats { | ||
// Asynchronous API | ||
export function decodeFileAsync(filePath: string, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void; | ||
@@ -88,2 +89,14 @@ export function decodeFileAsync(filePath: string, format: formats, template?: string): Promise<BarcodeResult[]>; | ||
// Synchronous API | ||
export function decodeFile(filePath: string, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void; | ||
export function decodeFile(filePath: string, format: formats, template?: string): BarcodeResult[]; | ||
export function decodeFileStream(stream: any, length: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void; | ||
export function decodeFileStream(stream: any, length: number, format: formats, template?: string): BarcodeResult[]; | ||
export function decodeBase64(base64String: string, format: formats, callback: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void; | ||
export function decodeBase64(base64String: string, format: formats, template?: string): BarcodeResult[]; | ||
export function decodeYUYV(data: any, width: number, height: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void; | ||
export function decodeYUYV(data: any, width: number, height: number, format: formats, template?: string): BarcodeResult[]; | ||
export function decodeBuffer(buffer: any, width: number, height: number, stride: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void; | ||
export function decodeBuffer(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): BarcodeResult[]; | ||
143
index.js
@@ -94,2 +94,29 @@ if (process.platform === 'win32') { | ||
}, | ||
decodeFile: function () { | ||
var callback = arguments[2]; | ||
var template = ""; | ||
if (callback && typeof callback === 'function') { | ||
template = arguments[3]; | ||
} | ||
else { | ||
template = arguments[2]; | ||
} | ||
checkBarcodeReader(); | ||
let result; | ||
let error; | ||
barcodeReader.decodeFile(arguments[0], arguments[1], function (err, msg) { | ||
result = msg; | ||
error = err; | ||
}, template); | ||
if (callback && typeof callback === 'function') { | ||
if (error) { | ||
callback(error); | ||
} else { | ||
callback(null, result); | ||
} | ||
} else { | ||
return result; | ||
} | ||
}, | ||
decodeFileStreamAsync: function () { | ||
@@ -126,2 +153,31 @@ var callback = arguments[3]; | ||
}, | ||
decodeFileStream: function () { | ||
var callback = arguments[3]; | ||
var template = ""; | ||
if (callback && typeof callback === 'function') { | ||
template = arguments[4]; | ||
} | ||
else { | ||
template = arguments[3]; | ||
} | ||
checkBarcodeReader(); | ||
let result; | ||
let error; | ||
barcodeReader.decodeFileStream(arguments[0], arguments[1], arguments[2], function (err, msg) { | ||
result = msg; | ||
error = err; | ||
}, template); | ||
if (callback && typeof callback === 'function') { | ||
if (error) { | ||
callback(error); | ||
} else { | ||
callback(null, result); | ||
} | ||
} | ||
else { | ||
return result; | ||
} | ||
}, | ||
decodeBase64Async: function () { | ||
@@ -157,2 +213,31 @@ var callback = arguments[2]; | ||
}, | ||
decodeBase64: function () { | ||
var callback = arguments[2]; | ||
var template = ""; | ||
if (callback && typeof callback === 'function') { | ||
template = arguments[3]; | ||
} | ||
else { | ||
template = arguments[2]; | ||
} | ||
checkBarcodeReader(); | ||
let result; | ||
let error; | ||
barcodeReader.decodeBase64(arguments[0], arguments[1], function (err, msg) { | ||
result = msg; | ||
error = err; | ||
}, template); | ||
if (callback && typeof callback === 'function') { | ||
if (error) { | ||
callback(error); | ||
} else { | ||
callback(null, result); | ||
} | ||
} | ||
else { | ||
return result; | ||
} | ||
}, | ||
decodeYUYVAsync: function () { | ||
@@ -188,2 +273,31 @@ var callback = arguments[4]; | ||
}, | ||
decodeYUYV: function () { | ||
var callback = arguments[4]; | ||
var template = ""; | ||
if (callback && typeof callback === 'function') { | ||
template = arguments[5]; | ||
} | ||
else { | ||
template = arguments[4]; | ||
} | ||
checkBarcodeReader(); | ||
let result; | ||
let error; | ||
barcodeReader.decodeYUYV(arguments[0], arguments[1], arguments[2], arguments[3], function (err, msg) { | ||
result = msg; | ||
error = err; | ||
}, template); | ||
if (callback && typeof callback === 'function') { | ||
if (error) { | ||
callback(error); | ||
} else { | ||
callback(null, result); | ||
} | ||
} | ||
else { | ||
return result; | ||
} | ||
}, | ||
decodeBufferAsync: function () { | ||
@@ -219,2 +333,31 @@ var callback = arguments[5]; | ||
}, | ||
decodeBuffer: function () { | ||
var callback = arguments[5]; | ||
var template = ""; | ||
if (callback && typeof callback === 'function') { | ||
template = arguments[6]; | ||
} | ||
else { | ||
template = arguments[5]; | ||
} | ||
checkBarcodeReader(); | ||
let result; | ||
let error; | ||
barcodeReader.decodeBuffer(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], function (err, msg) { | ||
result = msg; | ||
error = err; | ||
}, template); | ||
if (callback && typeof callback === 'function') { | ||
if (error) { | ||
callback(error); | ||
} else { | ||
callback(null, result); | ||
} | ||
} | ||
else { | ||
return result; | ||
} | ||
}, | ||
setInstanceType: function (type) { | ||
@@ -221,0 +364,0 @@ instanceType = type; |
{ | ||
"name": "barcode4nodejs", | ||
"version": "9.6.42", | ||
"version": "9.6.43", | ||
"description": "Node.js bindings to Dynamsoft Barcode Reader C/C++ SDK.", | ||
@@ -37,2 +37,2 @@ "keywords": [ | ||
} | ||
} | ||
} |
@@ -62,2 +62,4 @@ # Node.js Barcode & QR Code SDK | ||
- `initLicense(license-key)` | ||
**Asynchronous Methods** | ||
- `decodeFileAsync(fileName, barcodeTypes, callback, template)` or `await decodeFileAsync(fileName, barcodeTypes, template)` | ||
@@ -69,2 +71,9 @@ - `decodeFileStreamAsync(fileStream, fileSize, barcodeTypes, callback, template)` or `await decodeFileStreamAsync(fileStream, fileSize, barcodeTypes, template)` | ||
**Synchronous Methods** | ||
- `decodeFile(fileName, barcodeTypes, callback, template)` or `decodeFile(fileName, barcodeTypes, template)` | ||
- `decodeFileStream(fileStream, fileSize, barcodeTypes, callback, template)` or `decodeFileStream(fileStream, fileSize, barcodeTypes, template)` | ||
- `decodeBase64(base64, barcodeTypes, callback, template)` or `decodeBase64(base64, barcodeTypes, template)` | ||
- `decodeYUYV(buffer, width, height, barcodeTypes, callback, template)` or `decodeYUYV(buffer, width, height, barcodeTypes, template)` | ||
- `decodeBuffer(buffer, width, height, stride, barcodeTypes, callback, template, maxBufferLength)` or `decodeBuffer(buffer, width, height, stride, barcodeTypes, template, maxBufferLength)` | ||
## Template Usage | ||
@@ -71,0 +80,0 @@ 1. Visit the [barcode reader online demo](https://demo.dynamsoft.com/barcode-reader/). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
142192077
12582
208