Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

A Node.js library written in TypeScript capable of getting snapshots from Axis Communication cameras.

License

Notifications You must be signed in to change notification settings

FantasticFiasco/axis-snapshot-js

Repository files navigation

axis-snapshot

THIS REPOSITORY HAS MOVED TO FantasticFiasco/axis-js

Build Status Coverage Status npm version SemVer compatible dependencies Status devDependencies Status

A Node.js library written in TypeScript capable of getting snapshots from Axis Communication cameras.

Table of contents


Super simple to use

import { writeFileSync } from 'fs';
import { Connection, Protocol, Snapshot } from 'axis-snapshot';

const connection = new Connection(Protocol.Http, '192.168.1.102', 80, 'root', '32naJzkJdZ!7*HK&Dz');
const snapshot = new Snapshot(connection);

snapshot.jpeg({ compression: 20, rotation: 180 })
  .then((image: Buffer) => writeFileSync('snapshot.jpeg', image));

Installation

npm install axis-snapshot
# or
yarn add axis-snapshot

Family of packages

The following NPM packages have been created to provide a smooth experience with devices from Axis Communications.

  • axis-discovery - A Node.js client library written in TypeScript capable of searching for Axis Communication cameras using Bonjour and SSDP (UPnP).
    • axis-discovery-bonjour - A Node.js Bonjour client library written in TypeScript capable of searching for Axis Communication cameras.
    • axis-discovery-ssdp - A Node.js SSDP (UPnP) client library written in TypeScript capable of searching for Axis Communication cameras.
  • axis-configuration - A Node.js library written in TypeScript capable of configuring Axis Communication cameras.
  • axis-maintenance - A Node.js library written in TypeScript capable of running maintenance operations on cameras from Axis Communication.
  • axis-snapshot - This package

API

Snapshot

The Snapshot class is the main class in the package. With it you take BMP and JPEG snapshots given that the operations are supported by the camera.

class Snapshot {
    /**
     * Takes a {link https://wikipedia.org/wiki/BMP_file_format|BMP} snapshot from the camera.
     * @throws {UnauthorizedError} User is not authorized to perform operation.
     * @throws {RequestError} Request failed.
     */
    bmp(options?: SnapshotOptions): Promise<Buffer>;

    /**
     * Takes a {link https://en.wikipedia.org/wiki/JPEG|JPEG} snapshot from the camera.
     * @throws {UnauthorizedError} User is not authorized to perform operation.
     * @throws {RequestError} Request failed.
     */
    jpeg(options?: SnapshotOptions): Promise<Buffer>;
}

Credit

Thank you JetBrains for your important initiative to support the open source community with free licenses to your products.

JetBrains