1.2.3 • Published 6 years ago

subtitle-utils v1.2.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

subtitle-utils

A simple utils for subtitle such as SRT, WebVTT.

Build Status codecov

Example

const Subtitle = require('subtitle-utils');

const exampleSRT = `
  1
  00:02:17,440 --> 00:02:20,375
  Senator, we're making
  our final approach into Coruscant.

  2
  00:02:20,476 --> 00:02:22,501
  Very good, Lieutenant.

`;

Subtitle.fromSRT(exampleSRT).toVTT();
  

Installation

npm install subtitle-utils

API

static Subtitle.fromSRT(data: string): Subtitle

Create a Subtitle instance from SubRip SRT subtitle.

static Subtitle.fromVTT(data: string): Subtitle

Create a Subtitle instance from WebVTT subtitle.

Subtitle.subtitles: ISubtitle[]

Get array of subtitle object.

Subtitle.toSRT(data: string): string

Returns SubRip SRT subtitle value.

Subtitle.toVTT(data: string): string

Returns WebVTT subtitle value;

1.2.3

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago