New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

srt-to-vtt

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

srt-to-vtt - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

23

index.js

@@ -9,2 +9,11 @@ var split = require('split2')

var convert = function () {
return buf.join('\r\n')
.replace(/\{\\([ibu])\}/g, '</$1>')
.replace(/\{\\([ibu])1\}/g, '<$1>')
.replace(/\{([ibu])\}/g, '<$1>')
.replace(/\{\/([ibu])\}/g, '</$1>')
.replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g, '$1.$2') + '\r\n\r\n'
}
var write = function (line, enc, cb) {

@@ -16,8 +25,3 @@ if (line.trim()) {

line = buf.join('\r\n')
.replace(/\{\\([ibu])\}/g, '</$1>')
.replace(/\{\\([ibu])1\}/g, '<$1>')
.replace(/\{([ibu])\}/g, '<$1>')
.replace(/\{\/([ibu])\}/g, '</$1>')
.replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g, '$1.$2') + '\r\n\r\n'
line = convert()

@@ -28,5 +32,10 @@ buf = []

var parse = through.obj(write)
var flush = function (cb) {
if (buf.length) this.push(convert())
cb()
}
var parse = through.obj(write, flush)
parse.push('WEBVTT FILE\r\n\r\n')
return pumpify(utf8({newline: false, detectSize: 4095}), split(), parse)
}
{
"name": "srt-to-vtt",
"version": "1.1.0",
"version": "1.1.1",
"description": "Transform stream that converts srt files to vtt files (html5 video subtitles)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -42,1 +42,11 @@ var tape = require('tape')

})
tape('missing file ending CRLF', function (t) {
var convert = srt2vtt()
convert.write('1\r\n00:00:10,500 --> 00:00:13,000\r\nthis is a test\r\n\r\n2\r\n00:00:14,500 --> 00:00:15,000\r\nthis is a test\r\n')
convert.end()
convert.pipe(concat(function (data) {
t.same(data.toString(), 'WEBVTT FILE\r\n\r\n1\r\n00:00:10.500 --> 00:00:13.000\r\nthis is a test\r\n\r\n2\r\n00:00:14.500 --> 00:00:15.000\r\nthis is a test\r\n\r\n')
t.end()
}))
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc