Go to file
Sam Therapy 97c49ed47f
continuous-integration/drone/push Build is passing Details
Edit README
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-05-12 22:09:04 +02:00
.vscode Add the library 2022-05-12 20:54:40 +02:00
scripts Edit README 2022-05-12 22:09:04 +02:00
.drone.yml Add the library 2022-05-12 20:54:40 +02:00
.gitignore Add the library 2022-05-12 20:54:40 +02:00
LICENSE Initial commit 2022-05-12 18:56:05 +00:00
README.md Edit README 2022-05-12 22:09:04 +02:00
mod.ts fix lint 2022-05-12 20:55:15 +02:00
test.ts Add the library 2022-05-12 20:54:40 +02:00

README.md

SRT-to-VTT

A basic library to convert from srt to vtt

This code is taken from the excellent webvtt.org, I merely adapted it to work as a library.

Usage

const srt = `1
00:00:01,000 --> 00:00:02,000
Hello, world!
`;

console.log(srt2webvtt(srt));
`
WEBVTT

1
00:00:00.000 --> 00:00:00.000
Hello, world!
`;

Installing

This was written using deno, an alternative JavaScript runtime to node, so you'll first need to install deno.

Use in Deno

If you're using Deno, using this library is as simple as adding

import srt2webvtt from "https://git.froth.zone/sam/srt-to-vtt/raw/branch/master/mod.ts";

to your code.

Use in Node

If you're using Node, you can use the same code as above, but instead of importing it from a URL, you'll need to import it from npm: npm install deno-srt-to-vtt.

License

All source code is available under the MIT License.