Is it possible to use this without saving a file?
I've tried playing around with saveShots, output and callbackReturn, but non of them seem to allow me to stop the saving of the photo as a file. I really only need the photo in memory though, so it's just unnecessary overhead for me.
As far as I can tell, there isn't-- I think that the issue is that the way it gets the data is by running a command to save an image, then getting that images data-- here's a bit of a workaround that I find works, just delete the file that gets saved immediately. A bit annoying, but eh
const nw = require('node-webcam');
const fs = require('fs');
let cam = nw.create({
callbackReturn: 'buffer'
});
cam.capture('delete', (err, data) => {
if (err) {
console.log(err);
} else {
// Data is buffer w/ image
fs.unlinkSync('delete.jpg');
}
});
ah dang, this is bad limitation as write/reads off a drive are obviously much slower then memory, wish the buffer option just returned the buffer without saving, kinda makes it pointless to even have the callback controls.