axis-snapshot
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

axis-snapshot

axis-snapshot npm version SemVer compatible

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

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>;
}

Package Sidebar

Install

npm i axis-snapshot

Weekly Downloads

6

Version

4.0.0

License

Apache-2.0

Unpacked Size

27.6 kB

Total Files

19

Last publish

Collaborators

  • fantasticfiasco