osuColle
A simple node module to create, read and modify osu! beatmap collections.
Installation
This module is available as an npm package
npm install osucolle
Usage
Reading a database from a buffer.
const osuColle = ;const fs = ; //read your database filelet buffer = fs;//convert the buffer to a database objectlet database = buffer; console;
Result:
{
version: 20191211 //osu version
size: 2 //amount of collections in this database
collections: { //collections in this database
collection1: {
name: "collection1", //name of the collection
size: 3, //amount of beatmaps in this collection
hashes: [ //list of MD5 hashes of the beatmaps
"c8f08438204abfcdd1a748ebfae67421",
...,
...
]
},
...: {
...
}
}
}
Reading a single collection
const osuColle = ;const fs = ; let buffer = fs;let database = buffer; //find a collection by namelet collectionName = "collection1";let myCollection = database; console;
Result:
{
name: "collection1", //name of the collection
size: 3, //amount of beatmaps in this collection
hashes: [ //list of MD5 hashes of the beatmaps
"c8f08438204abfcdd1a748ebfae67421",
...,
...
]
}
Creating a database
const osuColle = ;//construct a databaseconst myDatabase = ; //add a collection to the databaselet collectionName = "My Collection"; myDatabase; //add a beatmap to My Collection//a beatmap's MD5 hash can be found through the official osu! api, or in a local beatmap database.let hash = "c8f08438204abfcdd1a748ebfae67421"; myDatabase ; console;
Result:
{
version: 20191211 //osu version
size: 1 //amount of collections in this database
collections: { //collections in this database
My Collection: {
name: "My Collection", //name of the collection
size: 1, //amount of beatmaps in this collection
hashes: [ //list of MD5 hashes of the beatmaps
"c8f08438204abfcdd1a748ebfae67421"
]
}
}
}
To export the database, convert it to a buffer and save the result.
//convert myDatabase to a bufferlet myBuffer = myDatabase; //then save the buffer to ./collection.dbfs;
Modifying an existing database:
const osuColle = ;const myDatabase = ; let collectionName = "My Collection";let hash = "c8f08438204abfcdd1a748ebfae67421"; myDatabase;myDatabase ; //change the name of a collectionlet newCollectionName = "My New Collection"; myDatabase; //remove a beatmap from a collectionmyDatabase ; //remove a collection from a databasemyDatabase;
License
This project is licensed under the MIT License - see the LICENSE file for details