0.2.1 • Published 4 years ago

@johnny.reina/convert-srt v0.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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