Skins
Import .osk archives into Realm or pack installed skins back into archives.
import-skin
Imports an .osk archive into the Realm database and its file store.
sh
cd examples/import-skin
npm install
npm startImport the archive in one call. The importer reads skin.ini, stores the archive's files, and creates the skin record in Realm.
js
View sourceconsole.log(`\nImporting ${oskPath}...`)
const result = await initialized.osk.import(oskPath)
console.log(` Name: ${result.name}`)
console.log(` Creator: ${result.creator}`)
console.log(` ID: ${result.id}`)
console.log(` Files: ${result.files}`)
console.log(` Hash: ${result.hash}`)
API used: init · OsuFilesAPI#osk · ImportedSkinData
export-random-skin
Picks an installed skin at random and exports it as an .osk archive.
sh
cd examples/export-random-skin
npm install
npm startAsk the skin query for usable entries. Built-in or incomplete skins may not have enough file data to export, so they are left out.
js
View sourceconst skins = initialized.skins.get.usable()
if (skins.length === 0) {
console.log('No usable skins found.')
return
}
const chosen = skins[Math.floor(Math.random() * skins.length)]
Pass the skin's Realm ID to the exporter. It gathers the referenced files and writes them to an .osk archive.
js
View sourceawait initialized.osk.export(chosen.ID.toString(), outputPath)
API used: init · OsuFilesAPI#skins · OsuFilesAPI#osk