Skip to content

merriman-labs/convert-srt

Repository files navigation

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;
}

About

Convert .srt subtitle files to JavaScript objects

Resources

License

Stars

Watchers

Forks