Skip to content

Include this library to take a snapshot of a camera with the onvif library

Notifications You must be signed in to change notification settings

chriswiggins/onvif-snapshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onvif-snapshot

Include this library to take a snapshot of a camera with the onvif library.

Installation

npm install --save onvif onvif-snapshot

Returns an object:

{
	mimeType: 'jpg|png',
	rawImage: <Node.JS Buffer>
}

Examples

Promise

const Onvif = require('onvif');
require('onvif-snapshot');

const Cam = new Onvif.Cam({
	hostname: process.env.HOSTNAME,
	username: process.env.USER,
	password: process.env.PASSWORD
}, async function(err){
	if(err) throw err;


	try{
		var data = await this.getSnapshot();
	}catch(e){
		return console.error(e);
	}

	console.log(data);
}); 

Callback

const Onvif = require('onvif');
require('onvif-snapshot');

const Cam = new Onvif.Cam({
	hostname: process.env.HOSTNAME,
	username: process.env.USER,
	password: process.env.PASSWORD
}, function(err){
	if(err) throw err;

	this.getSnapshot((err, data) => {
		if(err) throw err;

		console.log(data);
	});
}); 

About

Include this library to take a snapshot of a camera with the onvif library

Resources

Stars

Watchers

Forks

Packages

No packages published