0.1.11 • Published 6 months ago

ass-compiler v0.1.11

Weekly downloads
468
License
MIT
Repository
github
Last release
6 months ago

ass-compiler

GitHub Action Coverage Dependencies NPM version License File size jsDelivr

Parses and compiles ASS subtitle format to easy-to-use data structure.

Online Viewer

Installation

npm install ass-compiler

Usage

You can use parse or compile as your need.

import { parse, stringify, compile, decompile } from 'ass-compiler';

// ASS file content
const text = `
[Script Info]
; ...
`;

// parse just turn ASS text into JSON
const parsedASS = parse(text);
const stringifiedText = stringify(parsedASS);

// compile will get rid of invalid tags, merge duplicated tags, transform drawings, etc.
const compiledASS = compile(text, options);
const decompiledText = decompile(compiledASS);

options

{
  // A Style named `Default` will be automatic generated by options.defaultStyle
  // if it is not exists in `[V4+ Style]` section.
  defaultStyle: {
    Name: 'Default',
    Fontname: 'Arial',
    Fontsize: '20',
    PrimaryColour: '&H00FFFFFF&',
    SecondaryColour: '&H000000FF&',
    OutlineColour: '&H00000000&',
    BackColour: '&H00000000&',
    Bold: '0',
    Italic: '0',
    Underline: '0',
    StrikeOut: '0',
    ScaleX: '100',
    ScaleY: '100',
    Spacing: '0',
    Angle: '0',
    BorderStyle: '1',
    Outline: '2',
    Shadow: '2',
    Alignment: '2',
    MarginL: '10',
    MarginR: '10',
    MarginV: '10',
    Encoding: '1',
  },
}

For details of data structure, please use the online viewer.

0.1.10

7 months ago

0.1.11

6 months ago

0.1.9

8 months ago

0.1.8

11 months ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

7 years ago

0.0.0

7 years ago