@johnny.reina/convert-srt
v0.2.1
Published
Convert SRT file to JS objects
Downloads
19
Readme
SRT Converter
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;
}