const fs = require('fs');
const path = require('path');
const dp = require('@ntlab/dplib');
let xstatus = null;
dp.init();
console.log('Readers:', dp.getReaders());
function capture(callback) {
console.log('\n=== Capture raw image ===\n');
dp.startAcquire({ raw: true }, (status, data) => {
switch (status) {
case 'disconnected':
if (xstatus != status) {
console.log('Please connect fingerprint reader...');
}
break;
case 'connected':
console.log('Swipe your finger to capture the image...');
break;
case 'error':
break;
case 'complete':
dp.stopAcquire(() => {
callback(data);
});
break;
}
xstatus = status;
});
}
function loopCapture() {
capture(async (data) => {
const filename = path.join(process.cwd(), 'finger.bmp');
fs.writeFileSync(filename, Buffer.from(data));
console.log(`Saved to ${filename}`);
loopCapture();
});
};
loopCapture();
console:
On console, the process exited after I put my finger on the reader.
Is this how it is intended?
If so, is there any way to make it looping, instead of exiting after one capture?
I tried the other code sample and the process doesn't exit after enrolling once, only after matching / identification which is intended on the code. So it looks like it's not something from my system environment that's messing with the process.
It seems like process exited after first capture or before the next capture.
Since it exited without any error or warning, I assume that it is intentional?
code (based on this code sample ):
console:![image](https://github.com/tohenk/node-dplib/assets/116622385/91117d98-274e-40cf-9129-41af9b8d3018)
On console, the process exited after I put my finger on the reader.
Is this how it is intended? If so, is there any way to make it looping, instead of exiting after one capture?
I tried the other code sample and the process doesn't exit after enrolling once, only after matching / identification which is intended on the code. So it looks like it's not something from my system environment that's messing with the process.