srt-stream-parser

0.0.4 • Public • Published

srt-stream-parser NPM version Build Status Dependency Status

Let's you stream decode srt files - gives you back a json string with the id, start, end and the dialogs. The start and end time are in milliseconds.

Installation

npm install srt-stream-parser --save-dev

Usage

var srt = require('srt-stream-parser');
var srt_file = fs.createReadStream('./path/to/your/file.srt');
 
var subutitles = [];
file.pipe(srt()).on('data', function(data) {
    var data = JSON.parse(data);
    subutitles.push(data);
}).on('end', function () {
    console.log('All done, parsed: ' + subutitles.length + ' subtitles');
});
 

Where in the single data entry concists of:

 {
     "id": "1337",
     "start": 56880000,
     "end": 57060000,
     "dialogs": ["A world without rules and controls,", "without borders or boundaries."]
 }

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i srt-stream-parser

Weekly Downloads

0

Version

0.0.4

License

ISC

Last publish

Collaborators

  • steffen