@camera.ui/nats
v0.0.27
Published
camera.ui nats package
Readme
@camera.ui/nats
NATS Server binary downloader for camera.ui - downloads the official NATS Server for internal messaging and RPC communication.
Installation
npm install @camera.ui/natsThe NATS Server binary will be automatically downloaded during installation.
Usage
import { natsServerPath, isNatsServerAvailable } from '@camera.ui/nats';
// Get NATS Server binary path
const natsServer = natsServerPath();
console.log('NATS Server path:', natsServer);
// Check if NATS Server is available
if (isNatsServerAvailable()) {
console.log('NATS Server is ready to use');
}Official NATS Server
This package downloads the official NATS Server binary used by camera.ui for:
- RPC Communication - Inter-service messaging between camera.ui components
- Event Distribution - Real-time event broadcasting
- Plugin Communication - Messaging between plugins and core
- Clustering - Multi-instance camera.ui deployments
Platform Support
Supported Platforms:
- Linux - x64, ARM64, ARMv6, ARMv7, x86, PowerPC64, S390X, MIPS64LE
- Windows - x64, ARM64, ARMv6, ARMv7, x86
- macOS - Intel (x64), Apple Silicon (ARM64)
- FreeBSD - x64
Examples
Basic Usage
import { natsServerPath } from '@camera.ui/nats';
import { spawn } from 'child_process';
const natsServer = spawn(natsServerPath(), [
'--config', 'nats.conf',
'--port', '4222'
]);Check Availability
import { isNatsServerAvailable, natsServerPath } from '@camera.ui/nats';
if (!isNatsServerAvailable()) {
console.error('NATS Server not found');
process.exit(1);
}
console.log('Using NATS Server at:', natsServerPath());Integration with Camera.UI
import { natsServerPath } from '@camera.ui/nats';
// Used internally by camera.ui for RPC communication
const natsServer = spawn(natsServerPath(), [
'--config', '/path/to/camera-ui/nats.conf',
'--port', '4222',
'--cluster_name', 'camera-ui'
]);Cross-Platform Installation
# Force specific platform/architecture
npm_config_os=linux npm_config_cpu=arm64 npm installExamples:
npm_config_os=linux npm_config_cpu=x64 # Linux x64
npm_config_os=linux npm_config_cpu=arm64 # Linux ARM64
npm_config_os=win32 npm_config_cpu=x64 # Windows x64
npm_config_os=darwin npm_config_cpu=arm64 # Apple SiliconFile Format Support
The installer automatically handles different archive formats:
- TAR.GZ - Linux and macOS binaries
- ZIP - Windows binaries
- DEB - Some Linux architectures (S390X, MIPS64LE)
Installation Process
The installer automatically:
- Detects your platform and architecture
- Downloads the appropriate binary from NATS official releases
- Extracts from archive (TAR.GZ, ZIP, or DEB)
- Makes executable (Unix systems)
- Cleans up temporary files
Installation Log
Detected platform: linux / arm64
Downloading NATS Server v2.11.4...
Extracting nats-server-v2.11.4-linux-arm64.tar.gz...
Making executable...
Done!NATS in Camera.UI
NATS Server provides the messaging backbone for camera.ui:
RPC Communication
- Plugin-to-core communication
- Service-to-service messaging
- Request/response patterns
Event Broadcasting
- Camera state changes
- Motion detection events
- System notifications
Clustering Support
- Multi-instance deployments
- Load balancing
- High availability
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.
License
MIT
Part of the camera.ui ecosystem - A comprehensive camera management solution.
