Parse an osu! map into a structured and type safe object.
Install package:
# npm
npm install @teages/osu-map
# yarn
yarn add @teages/osu-map
# pnpm
pnpm install @teages/osu-map
# bun
bun install @teages/osu-map
Import:
// ESM
import { parseMap } from '@teages/osu-map'
// CommonJS
const { parseMap } = require('@teages/osu-map')
Use:
import { parseMap } from '@teages/osu-map'
const mapFile = useRawMap()
const map = parseMap(mapFile)
console.log(`Map: ${map.metadata.TitleUnicode} - ${map.metadata.ArtistUnicode} [${map.metadata.Version}]`)
// verify the first timing point
const firstTiming = map.timingPoints[0]
if (!firstTiming || firstTiming.type !== 'uninherited') {
throw new Error('First timing point must be uninherited.')
}
console.log(`BPM of the first uninherited: ${firstTiming.BPM}`)
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
- Add more storyboard things
- Add
stringifyMap
function
Published under MIT License.
Test maps from:
They are used for testing purposes only and not MIT licensed.