Skip to content

steffenmllr/srt-stream-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •