WebKLV

Introduction

Web-compatible KLV data parsing library for JavaScript/TypeScript

WebKLV

WebKLV is a fully web-compatible KLV (Key-Length-Value) data parsing library for JavaScript/TypeScript with support for MISB ST 0601 (UAS Local Metadata) and MISB ST 0102 (Security Metadata).

What is KLV?

KLV (Key-Length-Value) is a binary encoding standard defined by SMPTE ST 336. It is widely used in:

  • Unmanned Aerial System (UAS) metadata streams
  • Video surveillance
  • Military and government data link standards (MISB)

Features

  • 100% web-compatible — only standard browser APIs (no Node.js polyfills)
  • Fully typed — strict TypeScript throughout
  • Zero dependencies — no runtime dependencies
  • MISB ST 0601 — all 105 element parsers
  • MISB ST 0102 — nested security metadata
  • Ergonomic — buffer in, structured data out
  • Pristine error handling — typed error classes

Quick Start

npm install webklv
import { StreamParser, UASLocalMetadataSet, PrecisionTimeStamp } from "webklv";

for (const packet of new StreamParser(buffer)) {
  if (packet instanceof UASLocalMetadataSet) {
    const ts = packet.get(PrecisionTimeStamp.key);
    console.log(ts?.value.toString());
    // "2009-01-12 22:08:22+00:00"
  }
}