Crate osynic_osudb

Crate osynic_osudb 

Source
Expand description

Logo

OsynicOsudb

πŸš€ High Performance Β· πŸ—οΈ Well-Architected Β· πŸ”§ WASM Support
A feature-complete osu! database parser library that supports parsing osu!.db, collection.db, and scores.db.

πŸ‡¨πŸ‡³ Chinese Β· πŸ‡ΊπŸ‡Έ English

Β§πŸ“„ Introduction

A high-performance osu! database parser library, reconstructed based on the excellent osu-db library. Supports all database file formats including osu!.db, collection.db, scores.db, and more, with full compatibility for osu! 2025+ versions.

§✨ Features

  • πŸš€ High-performance parsing based on nom8 parser
  • πŸ“¦ Support for all osu! database file formats
  • 🌐 Complete WASM support (browser and Node.js)
  • πŸ—οΈ Read-write separation design for easy maintenance
  • πŸ”’ Strong type system ensures data safety

Β§πŸ“¦ Installation

Β§Rust

[dependencies]
osynic_osudb = "0.1.4"

Β§JavaScript/TypeScript (via WASM)

npm install @osynicite/osynic-osudb

or

yarn add @osynicite/osynic-osudb

Β§πŸš€ Quick Start

Β§Rust Example

β“˜
use osynic_osudb::entity::osu::osudb::OsuDB;

fn main() {
    let mut osudb = OsuDB::from_file("osu!.db").unwrap();

    for (index, beatmap) in osudb.beatmaps.iter_mut().take(3).enumerate() {
        println!(
            "Song {}: {} - {}",
            index + 1,
            beatmap.artist_unicode.as_ref().unwrap(),
            beatmap.title_unicode.as_ref().unwrap()
        );
        println!("Creator: {}", beatmap.creator.as_ref().unwrap());
        println!("Difficulty: {}", beatmap.difficulty_name.as_ref().unwrap());
        println!("Audio: {}", beatmap.audio.as_ref().unwrap());
        println!("Hash: {}", beatmap.hash.as_ref().unwrap());
        println!("File Name: {}", beatmap.file_name.as_ref().unwrap());
        println!("Status: {:?}", beatmap.status);
        println!("Hitcircle Count: {}", beatmap.hitcircle_count);
        println!("Slider Count: {}", beatmap.slider_count);
        println!("Spinner Count: {}", beatmap.spinner_count);
        println!("Last Modified: {}", beatmap.last_modified);
        println!("Approach Rate: {}", beatmap.approach_rate);
        println!("Circle Size: {}", beatmap.circle_size);
        println!("HP Drain: {}", beatmap.hp_drain);
        println!("Overall Difficulty: {}", beatmap.overall_difficulty);
        println!("---------------------------------");
    }
}

Β§JavaScript/TypeScript Example

import { OsuDB } from '@osynicite/osynic-osudb';

async function main() {
    const response = await fetch('osu!.db');
    const buffer = await response.arrayBuffer();
    
    const osudb = OsuDB.from_buffer(new Uint8Array(buffer));
    
    osudb.beatmaps.slice(0, 3).forEach((beatmap, index) => {
        console.log(`Song ${index + 1}: ${beatmap.artist_unicode} - ${beatmap.title_unicode}`);
        console.log(`Creator: ${beatmap.creator}`);
        console.log(`Difficulty: ${beatmap.difficulty_name}`);
        console.log(`Hash: ${beatmap.hash}`);
        console.log('---------------------------------');
    });
}

main();

🎯 More examples: Check the examples/ directory for complete examples, or run cargo run --example example_name to see the actual effect.

Β§πŸ“š Documentation

§❀️ Acknowledgments

This project has been reconstructed based on the osu-db library with architectural optimizations, performance improvements, and version compatibility enhancements.

Special thanks to the authors of osu-db!

The osu-db project is based on Unlicense, and the project licenses are placed in the licenses/ directory.

§🀝 Contribution Guidelines

Β§How to Contribute

We welcome PRs and Issues! If you discover any issues or have improvement suggestions, please follow these guidelines:

Β§Code Contribution Standards

  • Coding Standards: Follow Rust official coding standards
  • Testing Requirements: New features must include test cases
  • Code Quality: Run cargo fmt and cargo clippy before submitting
  • Documentation Updates: Update relevant documentation and examples as needed

Β§Issue Submission Guidelines

  • Describe the specific scenario of the problem
  • Provide reproduction steps and error messages
  • Include relevant API endpoints and parameters if applicable

Β§Development Setup

  1. Clone the repository:
git clone https://github.com/osynicite/osynic_osudb.git
cd osynic_osudb
  1. Build the project:
cargo build
  1. Run tests:
cargo test
  1. Format code:
cargo fmt
  1. Lint with clippy:
cargo clippy --all-targets --all-features

Β§πŸ“œ License

This project is open source under the MIT License. Please respect the original author’s copyright.


Made with ❀️ by the Osynicite team

For support, join us on Discord

ModulesΒ§

entity
error
io
prelude

ConstantsΒ§

CHANGE_20140609
CHANGE_20191106
CHANGE_20250107