1.0.0 • Published 1 year ago

srt-file-parser v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

created by ahmetilhn

1.0.0

1 year ago