typescript-timecode
v0.0.5
Published
A typescript timecode converter
Downloads
22
Maintainers
Readme
typscript-timecode
A typscript tool to convert timecodes
Installation
For npm users:
npm install typescript-timecode
For yarn users:
yarn add typescript-timecode
import Timecode from "typescript-timecode";
// To convert millisecond to standard time code
const t1 = Timecode.MillisecondsToTime(320009); // t1 = "05:20";
//if need ms then pass separator
const t2 = Timecode.MillisecondsToTime(320009, "."); // t2 = "05:20.009";
// To convert millisecond to HH:MM:ss time code
const t3 = Timecode.MillisecondsToHHMMss(320009); // t3 = "00:05:20";
// To convert millisecond to HH:MM:ss.SSS time code
const t4 = Timecode.MillisecondsToHHMMssSSS(320009); // t4 = "00:05:20.009";
// To convert millisecond to HH:MM:ss.SSS time code
const t5 = Timecode.MillisecondsToHHMMssSSS(320009, ","); // t5 = "00:05:20,009";
// To convert millisecond to HH:MM:ss.SSS time code
const t6 = Timecode.MillisecondsToHHMMssSSS(320009, ":"); // t6 = "00:05:20:009";
// To convert a standard time code, HHMMss, and HHMMssSSS to milliseconds.
const ms1 = Timecode.TimetoMilliseconds("00:00:03.09"); // ms1 = 3009;
Tests
To run them, just do:
npm run test
Contributing
Any is welcomed. Just open a PR.