subtitling
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Subtitling

PRs Welcome Version

A subtitle parser written in TypeScript

# yarn
yarn add subtitling
 
# npm
npm i --save subtitling

Subrip

import fs from 'fs'
import { Subrip } from 'subtitling'
 
const file = fs.readFileSync('path/to/subtitle.srt')
 
const subtitle = new Subrip(file)
console.log(subtitle.getFirstCue())

Output

SubripCue {
  cue{
    id1,
    time{
      startTime'00:00:23,046',
      endTime'00:00:27,546',
      startTimeMS23046,
      endTimeMS27546
    },
    text[ 'This is the first line.', 'This is the second line.' ]
  }
}

There are methods for cues, like: getCPS(), getDuration() and many others.

Supported formats

  • Subrip (.srt)
  • WebVTT (.vtt)

Package Sidebar

Install

npm i subtitling

Weekly Downloads

85

Version

1.0.1

License

MIT

Unpacked Size

13.9 kB

Total Files

28

Last publish

Collaborators

  • alexandremt