@osbjs/osbjs
Version:
a minimalist osu! storyboarding framework
25 lines (24 loc) • 1.03 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Beatmap = void 0;
const fs_1 = require("fs");
const ParserHelpers_1 = require("./Utils/ParserHelpers");
class Beatmap {
/**
* Parse a beatmap and return the corresponding information.
* @param path Path to .osu file
*/
constructor(path) {
this.path = path;
if (!(0, fs_1.existsSync)(path))
throw new Error("File doesn't exists");
this._raw = (0, fs_1.readFileSync)(this.path, 'utf-8');
this.difficulty = (0, ParserHelpers_1.parseDifficulty)(this._raw);
this.metadata = (0, ParserHelpers_1.parseMetadata)(this._raw);
this.colors = (0, ParserHelpers_1.parseColors)(this._raw);
this.hitObjects = (0, ParserHelpers_1.parseHitObjects)(this._raw);
this.timingPoints = (0, ParserHelpers_1.parseTimingPoints)(this._raw);
this.audioFilename = (0, ParserHelpers_1.getAudioFilename)(this._raw);
}
}
exports.Beatmap = Beatmap;