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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@serendevity/webvtt-validator

v0.1.3

Published

A lightweight WebVTT validation library with a beautiful UI

Downloads

434

Readme

WebVTT Validator

CI Pages npm License: MIT

A lightweight JavaScript library for validating WebVTT (Web Video Text Tracks) files in the browser. This library provides a simple API for validating WebVTT content and comes with a beautiful, responsive web interface for testing.

Links

Support policy

This package is tested against Node current LTS and the previous LTS.

  • CommonJS (require) support is best effort.

Features

  • Validates WebVTT format and syntax
  • Checks for common errors in timestamps and cue formatting
  • Lightweight with no external dependencies
  • Beautiful and responsive web interface
  • Supports file upload and direct input
  • Detailed error and warning messages

Installation

Node.js (via npm/pnpm/yarn)

# npm
npm install webvtt-validator

# pnpm
pnpm add webvtt-validator

# yarn
yarn add webvtt-validator

Deno (via JSR)

import { parse, DiagnosticSeverity, formatDiagnostics } from "jsr:@khattaksd/webvtt-validator";

Or add to your deno.json:

{
  "imports": {
    "webvtt": "jsr:@khattaksd/webvtt-validator@^0.1.0"
  }
}

Usage

In Deno

import { parse, DiagnosticSeverity, formatDiagnostics } from "jsr:@khattaksd/webvtt-validator";

const result = parse('WEBVTT\n\n00:00:01.000 --> 00:00:05.000\nHello, world!');

const errors = result.diagnostics.filter(d => d.severity === DiagnosticSeverity.Error);
console.log(errors.length === 0);
console.log(formatDiagnostics(result.diagnostics));

In the Browser

The dist/index.mjs bundle is browser-compatible ESM.

In Node.js

ESM

import { parse, DiagnosticSeverity, formatDiagnostics } from 'webvtt-validator';

const result = parse('WEBVTT\n\n00:00:01.000 --> 00:00:05.000\nHello, world!');

const errors = result.diagnostics.filter(d => d.severity === DiagnosticSeverity.Error);
console.log(errors.length === 0);
console.log(formatDiagnostics(result.diagnostics));

CommonJS (best effort)

const { parse, DiagnosticSeverity, formatDiagnostics } = require('webvtt-validator');

const result = parse('WEBVTT\n\n00:00:01.000 --> 00:00:05.000\nHello, world!');
const errors = result.diagnostics.filter(d => d.severity === DiagnosticSeverity.Error);
console.log(errors.length === 0);
console.log(formatDiagnostics(result.diagnostics));

Web Interface

Open the demo/index.html file in your browser to use the web interface for validating WebVTT files.

API Reference

parse(input, options?)

Parses WebVTT input and returns cues plus a structured diagnostics list.

Validation Rules

The validator checks for the following:

  • Presence of the WEBVTT header
  • Valid timestamp format (HH:MM:SS.mmm --> HH:MM:SS.mmm)
  • Start time is before end time in each cue
  • Proper cue separation with blank lines
  • No empty cue blocks

Building from Source

  1. Clone the repository
  2. Install dependencies:
    pnpm install
  3. Build the library:
    pnpm run build

The built files will be available in the dist directory.

License

MIT. See LICENSE.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. See CONTRIBUTING.md.

Demo

Try the demo by opening demo/index.html in your browser after running pnpm run build.