Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TJBot.prototype._setupCamera = function() {
winston.verbose('TJBot initializing Camera');
this._camera = new Raspistill({
width: this.configuration.see.camera.width,
height: this.configuration.see.camera.height,
noPreview: true,
encoding: 'jpg',
outputDir: './',
verticalFlip: this.configuration.see.camera.verticalFlip,
horizontalFlip: this.configuration.see.camera.horizontalFlip,
time: 1
});
// versions of node-raspistill < 0.0.11 don't have the `time` option, so
// force it in if we don't find it
if (!this._camera.options.hasOwnProperty('time')) {
winston.silly('node-raspistill camera option for `time` not found, swizzling it in');
var self = this._camera;
self.processOptionsOriginal = self.processOptions;
const Raspistill = require('node-raspistill').Raspistill;
const RaspistillInterruptError = require('node-raspistill').RaspistillInterruptError;
const raspistill = new Raspistill({
fileName: 'image%04d',
encoding: 'jpg',
width: 640,
height: 480
});
let i = 0;
raspistill.timelapse(1000, 30000, (image) => {
i++;
console.log('got ' + i + ' photo');
if (i === 5) {
console.log('trying to stop');
raspistill.stop();
}
})
.then(() => {
const Raspistill = require('node-raspistill').Raspistill;
const RaspistillInterruptError = require('node-raspistill').RaspistillInterruptError;
const raspistill = new Raspistill({
fileName: 'image%04d',
encoding: 'jpg',
noFileSave: true,
width: 640,
height: 480
});
let i = 0;
raspistill.timelapse(1000, 30000, (image) => {
i++;
console.log('got ' + i + ' photo');
if (i === 5) {
console.log('trying to stop');
raspistill.stop();
}
})
const Raspistill = require('node-raspistill').Raspistill;
const raspistill = new Raspistill({
fileName: 'image%04d',
encoding: 'jpg',
width: 640,
height: 480
});
let i = 0;
raspistill.timelapse(1000, 30000, (image) => {
i++;
console.log('photo ' + i + ' is now stored on drive ');
})
.then(() => {
console.log('timelapse ended')
})
.catch((err) => {
console.log('something bad happened', err);
const Raspistill = require('node-raspistill').Raspistill;
const fs = require('fs');
const raspistill = new Raspistill({
noFileSave: true,
encoding: 'bmp'
});
raspistill.takePhoto()
.then((photo) => {
console.log('took photo');
fs.writeFile('1.bmp', photo, {encoding: 'binary'}, function (err) {
if (err) {
throw err;
}
console.log('saved photo');
})
})
.catch((error) => {
const Raspistill = require('node-raspistill').Raspistill;
const RaspistillInterruptError = require('node-raspistill').RaspistillInterruptError;
const raspistill = new Raspistill({
fileName: 'image%04d',
encoding: 'jpg',
width: 640,
height: 480
});
let i = 0;
raspistill.timelapse(1000, 30000, (image) => {
i++;
console.log('got ' + i + ' photo');
if (i === 5) {
console.log('trying to stop');
raspistill.stop();
}
const Raspistill = require('node-raspistill').Raspistill;
const RaspistillInterruptError = require('node-raspistill').RaspistillInterruptError;
const raspistill = new Raspistill({
fileName: 'image%04d',
encoding: 'jpg',
noFileSave: true,
width: 640,
height: 480
});
let i = 0;
raspistill.timelapse(1000, 30000, (image) => {
i++;
console.log('got ' + i + ' photo');
if (i === 5) {
console.log('trying to stop');
raspistill.stop();