Buffer + Promise-based (no file writes) interface to Pi camera for Node.js
npm i -S picam4node
- You have full access to raspistill functionality.
- Outputs to Buffer object. No file writes; improves lifespan of your SD card for long-running camera monitor.
Images taken off raspistill (stock Raspbian binary); I am not aware of existing libraries connecting directly to the Pi camera.
const fs = require('fs'),
picam4node = require('./picam4node.js'),
cam = new picam4node.StillCamera()
cam.takeImage({
shutterspeed: 80000, /* or '-ss': 80000, */
width: 800, /* or '-w': 800, */
height: 600
}).then((data) => {
console.log(data)
fs.writeFileSync('photo.jpg', data)
}).catch((err) => {
console.log('ERROR: ', err)
})
Referenced heavily from servall/pi-camera-connect