npm.io
1.0.0 • Published 7 months ago

mod-meta

Licence
MIT
Version
1.0.0
Deps
0
Size
14 kB
Vulns
0
Weekly
0
Stars
4

mod-meta

Tracker mod metadata parser for .mod .xm .s3m .it

Returns title, trackerType, and message (when present in the module data).

Why

I created this package in 2016 for the needs of my keygenmusic.tk project.

Installation

$ npm install mod-meta

Usage

const mm = require('mod-meta');

// sync
const mdata = mm.getModMetaSync('pathToMod');
if (mdata) {
  console.log('Mod title: ', mdata.title);
  console.log('Tracker type: ', mdata.trackerType);
  console.log('Message: ', mdata.message);
} else {
  console.log('Error');
}

// sync (skip message parsing)
const mdataNoMsg = mm.getModMetaSync('pathToMod', {includeMessage: false});

// async (promise)
mm.getModMeta('pathToMod')
  .then((mdata) => {
    console.log('Mod title: ', mdata.title);
  })
  .catch((error) => {
    console.log(error);
  });

// async (promise, skip message parsing)
mm.getModMeta('pathToMod', {includeMessage: false})
  .then((mdata) => {
    console.log('Mod title: ', mdata.title);
  })
  .catch((error) => {
    console.log(error);
  });

Tests

$ npm test

Keywords