Skip to content

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.

Full source

sh
cd examples/import-skin
npm install
npm start

Import the archive in one call. The importer reads skin.ini, stores the archive's files, and creates the skin record in Realm.

js
console
.
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
}`)
View source

API used: init · OsuFilesAPI#osk · ImportedSkinData

export-random-skin ​

Picks an installed skin at random and exports it as an .osk archive.

Full source

sh
cd examples/export-random-skin
npm install
npm start

Ask 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
const 
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
)]
View source

Pass the skin's Realm ID to the exporter. It gathers the referenced files and writes them to an .osk archive.

js
await 
initialized
.
osk
.
export
(
chosen
.
ID
.
toString
(),
outputPath
)
View source

API used: init · OsuFilesAPI#skins · OsuFilesAPI#osk

Released under the MIT License.