npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@2bad/tvt

v2.0.0

Published

[![NPM version](https://img.shields.io/npm/v/@2bad/tvt)](https://www.npmjs.com/package/@2bad/tvt) [![License](https://img.shields.io/npm/l/@2bad/tvt)](https://opensource.org/license/MIT) [![GitHub Build Status](https://img.shields.io/github/actions/workfl

Downloads

486

Readme

TVT Device SDK

NPM version License GitHub Build Status Code coverage Written in TypeScript

A modern TypeScript SDK for TVT CCTV devices, providing a clean and type-safe interface for device management, monitoring, and control. This project is the result of extensive research and reverse engineering of TVT (Tongwei Video Technology) CCTV systems.

🌟 Features

  • Type-Safe API: Full TypeScript support with comprehensive type definitions
  • Async/Await: Modern promise-based API for better control flow
  • Lazy Loading: Efficient resource management with on-demand library loading
  • Error Handling: Robust error handling with detailed error messages
  • Logging: Built-in debug logging for easier troubleshooting
  • Documentation: Extensive JSDoc documentation for all methods

📦 Installation

npm install tvt

🚀 Quick Start

import { Device } from 'tvt'

try {
  // Create and initialize a new device instance
  const device = await Device.create('192.168.1.100', 9008)

  // Login to the device
  await device.login('admin', 'password')

  // Get device information
  const info = await device.getInfo()
  console.log(`Connected to ${info.deviceName}`)

  // Capture a snapshot
  await device.saveSnapshot(0, '/path/to/snapshot.jpg')

  // Clean up
  await device.dispose()
} catch (error) {
  console.error('Error:', error)
}

🔧 Core Features

Device Management

  • Device discovery
  • Async connection management
  • Authentication
  • Device information retrieval

Security Features

  • Alarm management
  • Manual alarm triggering
  • Event monitoring

Media Operations

  • Snapshot capture
  • Live stream management
  • Video recording

📚 API Reference

Device Class

The main interface for interacting with TVT devices.

class Device {
  static create(ip: string, port?: number, settings?: Settings): Promise<Device>
  login(user: string, pass: string): Promise<boolean>
  logout(): Promise<boolean>
  getInfo(): Promise<DeviceInfo>
  triggerAlarm(value: boolean): Promise<boolean>
  saveSnapshot(channel: number, filePath: string): Promise<boolean>
  dispose(): Promise<boolean>
  // ... and more
}

See API Documentation for detailed method descriptions.

🛠️ Development

Prerequisites

  • Node.js 18 or higher
  • Linux operating system (required for SDK operations)

Building from Source

git clone https://github.com/yourusername/tvt.git
cd tvt
npm install
npm run build

Running Tests

npm test

📁 Project Structure

tvt/
├── bin/            # Precompiled SDK libraries
├── docs/           # Documentation and examples
├── proto/          # Protocol definitions and dissectors
└── source/         # TypeScript implementation
    ├── lib/        # Core SDK implementation
    ├── helpers/    # Utility functions
    └── types/      # TypeScript type definitions

🔄 Migration from v1.x to v2.x

Breaking Changes

  1. All SDK methods now return Promises and require await:
// Before
const info = device.info

// After
const info = await device.getInfo()
  1. Device creation is now async and uses a factory method:
// Before
const device = new Device('192.168.1.100')

// After
const device = await Device.create('192.168.1.100')
  1. Property access changes:
// Before
device.info.deviceName

// After
const info = await device.getInfo()
info.deviceName

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Guidelines

  1. Follow TypeScript best practices
  2. Include tests for new features
  3. Update documentation as needed
  4. Follow the existing code style

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

This project is not officially associated with TVT Digital Technology Co., Ltd. It is an independent implementation based on research and reverse engineering. Use at your own risk.

🙏 Acknowledgments

  • TVT Digital Technology for their CCTV systems
  • The open-source community for various tools and libraries used in this project
  • Contributors who have helped improve this SDK

📬 Support

  • Create an issue for bug reports or feature requests