DEV Community

Cover image for Just Published an NPM Package πŸ”₯
Ali Abbas
Ali Abbas

Posted on

9 1

Just Published an NPM Package πŸ”₯

Hey there.πŸš€ I just published another NPM package on npmjs.com. The npm package converts the subtitle file (.srt) into a readable and well-standard JSON format.

Check out the NPM link SRT-Convert-JSON

Install

$ npm install srt-convert-json
Enter fullscreen mode Exit fullscreen mode

This package can be used to convert Movies Subtitle to JSON format

Usage

const convert = require('srt-convert-json')

convert.process("INPUT_FILE_PATH","OUTPUT_FILE_PATH")
// convert.process("./data.srt","./subtitle.json")
Enter fullscreen mode Exit fullscreen mode

For Example, this is an SRT File

1
00:02:38,910 --> 00:02:40,161
English! I'm English!

2
00:05:40,049 --> 00:05:41,801
It's grenadiers, mate.
Enter fullscreen mode Exit fullscreen mode

After converting, the output will be

[
    {
        "position": 1,
        "start": "00:02:38",
        "timer1": "910",
        "end": "00:02:40",
        "timer2": "161",
        "text": "English! I'm English!"
    },
    {
        "position": 2,
        "start": "00:05:40",
        "timer1": "049",
        "end": "00:05:41",
        "timer2": "801",
        "text": "It's grenadiers, mate."
    },
]
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here β†’

Top comments (5)

Collapse
 
pstev profile image
Petar Stevovski β€’

Interesting. Can it go the other way around too (from .json to .srt file) ? Maybe that could be useful for people that write subtitles. Also, just an idea, maybe convert it to a cli, so it can be used straight away, instead of first having to import it to a .js file and then running it?

Collapse
 
realabbas profile image
Ali Abbas β€’

Yeah . Sure I will work on it. Thanks for the idea and appreciation.

Collapse
 
dmahely profile image
Doaa Mahely β€’

Awesome idea! Will check this out soon πŸ‘Œ

Collapse
 
realabbas profile image
Ali Abbas β€’

Thank you for the appreciation

Collapse
 
realabbas profile image
Ali Abbas β€’

Thank you for the appreciation

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay