I Published .SRT file parser package

Ahmet İlhan - Jul 4 - - Dev Community

srt-file-parser

File parser for .srt (subtitle) file. It allows you to export the content of your .srt file as a string or buffer and retrieve it as objects in the array.

Installation

npm

npm install srt-file-parser

yarn

yarn add srt-file-parser

Usage

import srtFileParser from "srt-file-parser";
/**
 * {srtContent} string is srt file content
 */
const result: Array<BlockType> = srtFileParser(srtContent);
result.forEach((item: BlockType) => {
  //
});
Enter fullscreen mode Exit fullscreen mode

Types

type CaptionBlockType = {
  id: string;
  start: number; // type of ms
  end: number; // type of ms
  text: string;
};
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . .
Terabox Video Player