Skip to main content

CachedAssetsManager

class CachedAssetsManager

constructor

new CachedAssetsManager(client)
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
clientStarRail

Properties

client

The client that instantiated this

Type: StarRail


defaultCacheDirectoryPath

Default path of StarRail cache data directory

Type: string


_contentsSrc

List of the names of the files this library uses

Type: string[]


_langs

List of supported languages

Type: string[]


cacheDirectoryPath

Path of directory where StarRail cache data is stored

Type: string


Methods

cacheDirectorySetup

async

Create the necessary folders and files, and if the directory cacheDirectoryPath did not exist, move the cache files from the default path.

Returns: Promise<void>


fetchLanguageData

async

Obtains a text map for a specific language.

Returns: Promise<{[key: string]: string}>

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
langLanguageCode

checkForUpdates

async

Returns: Promise<boolean>

  • Whether the game data update is available or not.
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
useRawStarRailData✔️falseWhether to fetch from github repo (https://github.com/Dimbreath/StarRailData) instead of downloading cache.zip

fetchAllContents

async

Returns: Promise<void>

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
options.useRawStarRailData{useRawStarRailData?: boolean, ghproxy?: boolean}Whether to fetch from github repo (https://github.com/Dimbreath/StarRailData) instead of downloading cache.zip
options.ghproxyWhether to use ghproxy.com

hasAllContents

Returns: boolean

  • whether all StarRail cache data files exist.

updateContents

async

Returns: Promise<void>

  • true if there were any updates, false if there were no updates.
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
options.useRawStarRailData{useRawStarRailData?: boolean, ghproxy?: boolean, onUpdateStart?: () => Promise<void>, onUpdateEnd?: () => Promise<void>}✔️{}Whether to fetch from github repo (https://github.com/Dimbreath/StarRailData) instead of downloading cache.zip
options.ghproxyWhether to use ghproxy.com

activateAutoCacheUpdater

Returns: void

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
options.useRawStarRailData{useRawStarRailData?: boolean, instant?: boolean, ghproxy?: boolean, timeout?: number, onUpdateStart?: () => Promise<void>, onUpdateEnd?: () => Promise<void>, onError?: (error: Error) => Promise<void>}✔️{}Whether to fetch from github repo (https://github.com/Dimbreath/StarRailData) instead of downloading cache.zip
options.ghproxyWhether to use ghproxy.com
options.timeoutin milliseconds

deactivateAutoCacheUpdater

Disables the updater activated by activateAutoCacheUpdater

Returns: void


getLanguageDataPath

Returns: string

  • text map file path for a specific language
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
langLanguageCode

getJSONDataPath

Returns: string

  • excel bin file path
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestringwithout extensions (.json)

getStarRailCacheData

Returns: {[key: string]: JsonObject}

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestringwithout extensions (.json)

getLanguageData

Returns: {[key: string]: string}

  • text map for a specific language
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
langLanguageCode

getObjectKeysManager

Returns: ObjectKeysManager

  • ObjectKeysManager of this

refreshAllData

Clean memory of cache data.
Then reload data that was loaded before the clean if reload is true.
If reload is false, load each file as needed.

Returns: void

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
reload✔️false

removeUnusedTextData

Remove all unused text map entries

Returns: LanguageMap

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
data{[s: string]: {[s: string]: JsonObject}}
langsDataLanguageMap
showLog✔️true

_downloadCacheZip

async

Download the zip file, which contains StarRail cache data, from https://raw.githubusercontent.com/yuko1101/starrail.js/main/cache.zip

Returns: Promise<void>

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
options.ghproxy{ghproxy?: boolean}✔️{}Whether to use ghproxy.com