Skip to content

Commit 735051d

Browse files
committed
Remove all synchronous methods
1 parent 8e1a0ff commit 735051d

6 files changed

Lines changed: 296 additions & 317 deletions

File tree

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ The Node.js barcode QR code SDK is implemented by wrapping [Dynamsoft Barcode Re
7373
- `decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void`
7474
- `decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): Promise<BarcodeResult[]>`
7575
76-
**Synchronous Methods**
77-
- `decodeFile(filePath: string, format: formats, template?: string): BarcodeResult[]`
78-
- `decodeFileStream(stream: any, length: number, format: formats, template?: string): BarcodeResult[]`
79-
- `decodeBase64(base64String: string, format: formats, template?: string): BarcodeResult[]`
80-
- `decodeYUYV(data: any, width: number, height: number, format: formats, template?: string): BarcodeResult[]`
81-
- `decodeBuffer(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): BarcodeResult[]`
82-
8376
## Template Usage
8477
1. Visit the [barcode reader online demo](https://demo.dynamsoft.com/barcode-reader-v9/).
8578
2. Customize parameters in advanced settings and then download the template.

index.d.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ export interface BarcodeReader {
7878
decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
7979
decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): Promise<BarcodeResult[]>;
8080
destroyInstance(): void;
81-
82-
decodeFile(filePath: string, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
83-
decodeFile(filePath: string, format: formats, template?: string): BarcodeResult[];
84-
decodeFileStream(stream: any, length: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
85-
decodeFileStream(stream: any, length: number, format: formats, template?: string): BarcodeResult[];
86-
decodeBase64(base64String: string, format: formats, callback: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
87-
decodeBase64(base64String: string, format: formats, template?: string): BarcodeResult[];
88-
decodeYUYV(data: any, width: number, height: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
89-
decodeYUYV(data: any, width: number, height: number, format: formats, template?: string): BarcodeResult[];
90-
decodeBuffer(buffer: any, width: number, height: number, stride: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
91-
decodeBuffer(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): BarcodeResult[];
9281
}
9382

9483
export function getVersion(): string;
@@ -108,10 +97,3 @@ export function decodeYUYVAsync(data: any, width: number, height: number, format
10897
export function decodeYUYVAsync(data: any, width: number, height: number, format: formats, template?: string): Promise<BarcodeResult[]>;
10998
export function decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, callback?: (err: Error | null, result?: BarcodeResult[]) => void, template?: string): void;
11099
export function decodeBufferAsync(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): Promise<BarcodeResult[]>;
111-
112-
// Synchronous API
113-
export function decodeFile(filePath: string, format: formats, template?: string): BarcodeResult[];
114-
export function decodeFileStream(stream: any, length: number, format: formats, template?: string): BarcodeResult[];
115-
export function decodeBase64(base64String: string, format: formats, template?: string): BarcodeResult[];
116-
export function decodeYUYV(data: any, width: number, height: number, format: formats, template?: string): BarcodeResult[];
117-
export function decodeBuffer(buffer: any, width: number, height: number, stride: number, format: formats, template?: string): BarcodeResult[];

index.js

Lines changed: 134 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -91,33 +91,33 @@ module.exports = {
9191
return promise;
9292
}
9393
},
94-
decodeFile: function () {
95-
var callback = arguments[2];
96-
var template = "";
97-
if (callback && typeof callback === 'function') {
98-
template = arguments[3];
99-
}
100-
else {
101-
template = arguments[2];
102-
}
103-
checkBarcodeReader();
104-
let result;
105-
let error;
106-
barcodeReader.decodeFile(arguments[0], arguments[1], function (err, msg) {
107-
result = msg;
108-
error = err;
109-
}, template);
94+
// decodeFile: function () {
95+
// var callback = arguments[2];
96+
// var template = "";
97+
// if (callback && typeof callback === 'function') {
98+
// template = arguments[3];
99+
// }
100+
// else {
101+
// template = arguments[2];
102+
// }
103+
// checkBarcodeReader();
104+
// let result;
105+
// let error;
106+
// barcodeReader.decodeFile(arguments[0], arguments[1], function (err, msg) {
107+
// result = msg;
108+
// error = err;
109+
// }, template);
110110

111-
if (callback && typeof callback === 'function') {
112-
if (error) {
113-
callback(error);
114-
} else {
115-
callback(null, result);
116-
}
117-
} else {
118-
return result;
119-
}
120-
},
111+
// if (callback && typeof callback === 'function') {
112+
// if (error) {
113+
// callback(error);
114+
// } else {
115+
// callback(null, result);
116+
// }
117+
// } else {
118+
// return result;
119+
// }
120+
// },
121121
decodeFileStreamAsync: function () {
122122
var callback = arguments[3];
123123
var template = "";
@@ -149,35 +149,35 @@ module.exports = {
149149
return promise;
150150
}
151151
},
152-
decodeFileStream: function () {
153-
var callback = arguments[3];
154-
var template = "";
155-
if (callback && typeof callback === 'function') {
156-
template = arguments[4];
157-
}
158-
else {
159-
template = arguments[3];
160-
}
152+
// decodeFileStream: function () {
153+
// var callback = arguments[3];
154+
// var template = "";
155+
// if (callback && typeof callback === 'function') {
156+
// template = arguments[4];
157+
// }
158+
// else {
159+
// template = arguments[3];
160+
// }
161161

162-
checkBarcodeReader();
163-
let result;
164-
let error;
165-
barcodeReader.decodeFileStream(arguments[0], arguments[1], arguments[2], function (err, msg) {
166-
result = msg;
167-
error = err;
168-
}, template);
162+
// checkBarcodeReader();
163+
// let result;
164+
// let error;
165+
// barcodeReader.decodeFileStream(arguments[0], arguments[1], arguments[2], function (err, msg) {
166+
// result = msg;
167+
// error = err;
168+
// }, template);
169169

170-
if (callback && typeof callback === 'function') {
171-
if (error) {
172-
callback(error);
173-
} else {
174-
callback(null, result);
175-
}
176-
}
177-
else {
178-
return result;
179-
}
180-
},
170+
// if (callback && typeof callback === 'function') {
171+
// if (error) {
172+
// callback(error);
173+
// } else {
174+
// callback(null, result);
175+
// }
176+
// }
177+
// else {
178+
// return result;
179+
// }
180+
// },
181181
decodeBase64Async: function () {
182182
var callback = arguments[2];
183183
var template = "";
@@ -209,35 +209,35 @@ module.exports = {
209209
return promise;
210210
}
211211
},
212-
decodeBase64: function () {
213-
var callback = arguments[2];
214-
var template = "";
215-
if (callback && typeof callback === 'function') {
216-
template = arguments[3];
217-
}
218-
else {
219-
template = arguments[2];
220-
}
212+
// decodeBase64: function () {
213+
// var callback = arguments[2];
214+
// var template = "";
215+
// if (callback && typeof callback === 'function') {
216+
// template = arguments[3];
217+
// }
218+
// else {
219+
// template = arguments[2];
220+
// }
221221

222-
checkBarcodeReader();
223-
let result;
224-
let error;
225-
barcodeReader.decodeBase64(arguments[0], arguments[1], function (err, msg) {
226-
result = msg;
227-
error = err;
228-
}, template);
222+
// checkBarcodeReader();
223+
// let result;
224+
// let error;
225+
// barcodeReader.decodeBase64(arguments[0], arguments[1], function (err, msg) {
226+
// result = msg;
227+
// error = err;
228+
// }, template);
229229

230-
if (callback && typeof callback === 'function') {
231-
if (error) {
232-
callback(error);
233-
} else {
234-
callback(null, result);
235-
}
236-
}
237-
else {
238-
return result;
239-
}
240-
},
230+
// if (callback && typeof callback === 'function') {
231+
// if (error) {
232+
// callback(error);
233+
// } else {
234+
// callback(null, result);
235+
// }
236+
// }
237+
// else {
238+
// return result;
239+
// }
240+
// },
241241
decodeYUYVAsync: function () {
242242
var callback = arguments[4];
243243
var template = "";
@@ -268,35 +268,35 @@ module.exports = {
268268
return promise;
269269
}
270270
},
271-
decodeYUYV: function () {
272-
var callback = arguments[4];
273-
var template = "";
274-
if (callback && typeof callback === 'function') {
275-
template = arguments[5];
276-
}
277-
else {
278-
template = arguments[4];
279-
}
271+
// decodeYUYV: function () {
272+
// var callback = arguments[4];
273+
// var template = "";
274+
// if (callback && typeof callback === 'function') {
275+
// template = arguments[5];
276+
// }
277+
// else {
278+
// template = arguments[4];
279+
// }
280280

281-
checkBarcodeReader();
282-
let result;
283-
let error;
284-
barcodeReader.decodeYUYV(arguments[0], arguments[1], arguments[2], arguments[3], function (err, msg) {
285-
result = msg;
286-
error = err;
287-
}, template);
281+
// checkBarcodeReader();
282+
// let result;
283+
// let error;
284+
// barcodeReader.decodeYUYV(arguments[0], arguments[1], arguments[2], arguments[3], function (err, msg) {
285+
// result = msg;
286+
// error = err;
287+
// }, template);
288288

289-
if (callback && typeof callback === 'function') {
290-
if (error) {
291-
callback(error);
292-
} else {
293-
callback(null, result);
294-
}
295-
}
296-
else {
297-
return result;
298-
}
299-
},
289+
// if (callback && typeof callback === 'function') {
290+
// if (error) {
291+
// callback(error);
292+
// } else {
293+
// callback(null, result);
294+
// }
295+
// }
296+
// else {
297+
// return result;
298+
// }
299+
// },
300300
decodeBufferAsync: function () {
301301
var callback = arguments[5];
302302
var template = "";
@@ -327,35 +327,35 @@ module.exports = {
327327
return promise;
328328
}
329329
},
330-
decodeBuffer: function () {
331-
var callback = arguments[5];
332-
var template = "";
333-
if (callback && typeof callback === 'function') {
334-
template = arguments[6];
335-
}
336-
else {
337-
template = arguments[5];
338-
}
330+
// decodeBuffer: function () {
331+
// var callback = arguments[5];
332+
// var template = "";
333+
// if (callback && typeof callback === 'function') {
334+
// template = arguments[6];
335+
// }
336+
// else {
337+
// template = arguments[5];
338+
// }
339339

340-
checkBarcodeReader();
341-
let result;
342-
let error;
343-
barcodeReader.decodeBuffer(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], function (err, msg) {
344-
result = msg;
345-
error = err;
346-
}, template);
340+
// checkBarcodeReader();
341+
// let result;
342+
// let error;
343+
// barcodeReader.decodeBuffer(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], function (err, msg) {
344+
// result = msg;
345+
// error = err;
346+
// }, template);
347347

348-
if (callback && typeof callback === 'function') {
349-
if (error) {
350-
callback(error);
351-
} else {
352-
callback(null, result);
353-
}
354-
}
355-
else {
356-
return result;
357-
}
358-
},
348+
// if (callback && typeof callback === 'function') {
349+
// if (error) {
350+
// callback(error);
351+
// } else {
352+
// callback(null, result);
353+
// }
354+
// }
355+
// else {
356+
// return result;
357+
// }
358+
// },
359359
formats: formats,
360360
barcodeTypes: barcodeTypes,
361361
getVersion: dbr.getVersionNumber,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "barcode4nodejs",
3-
"version": "10.0.4",
3+
"version": "10.0.5",
44
"description": "Node.js bindings to Dynamsoft Barcode Reader C/C++ SDK.",
55
"keywords": [
66
"barcode",

0 commit comments

Comments
 (0)