Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 672 Bytes

README.md

File metadata and controls

26 lines (20 loc) · 672 Bytes

SRT Converter npm (scoped)

Convert .srt subtitle files to JavaScript objects

Installing

npm i @johnny.reina/convert-srt

Usage

toSrt(srt: string): Array<Subtitle>

The main export of this package. Accepts the string contents of a .srt file and returns an array of Subtitle objects.

toWebVTT(subs: Array<Subtitle>): string

Accepts an array of Subtitle objects and returns a WebVTT string.

Subtitle

interface Subtitle {
    index: number;
    from: string;
    to: string;
    text: string;
}