I Published .SRT file parser package

RMAG news

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) => {
//
});

Types

type CaptionBlockType = {
id: string;
start: number; // type of ms
end: number; // type of ms
text: string;
};
Please follow and like us:
Pin Share