### Install Dependencies - Docusaurus Website - shell Source: https://github.com/yuko1101/starrail.js/blob/main/docs/README.md Installs the project dependencies using Yarn. This command should be run after cloning the repository to set up the project environment. ```shell $ yarn ``` -------------------------------- ### Start Local Development Server - Docusaurus Website - shell Source: https://github.com/yuko1101/starrail.js/blob/main/docs/README.md Starts a local development server for the Docusaurus website. It typically opens a browser window and provides live reloading for changes during development. ```shell $ yarn start ``` -------------------------------- ### Install StarRail.js via npm with ghproxy Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Installs the latest version of the StarRail.js library using npm, utilizing ghproxy.com for potentially faster downloads of cache data. Requires Node.js 16 or newer. ```sh npm install starrail.js@latest --sr-ghproxy=true ``` -------------------------------- ### Build Static Website - Docusaurus Website - shell Source: https://github.com/yuko1101/starrail.js/blob/main/docs/README.md Generates the static content for the website into the 'build' directory. The output is ready to be served by any static hosting service. ```shell $ yarn build ``` -------------------------------- ### Install StarRail.js via npm Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Installs the latest version of the StarRail.js library and its default cache data using npm. Requires Node.js 16 or newer. ```sh npm install starrail.js@latest ``` -------------------------------- ### Get All Light Cones List Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Shows how to retrieve a list of all available Honkai: Star Rail Light Cones using the getAllLightCones method. The example demonstrates mapping the list to get Light Cone names in Japanese. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); const lightCones = client.getAllLightCones(); // print light cone names in language "jp" console.log(lightCones.map(w => w.name.get("jp"))); ``` -------------------------------- ### Deploy Website (Non-SSH) - Docusaurus Website - shell Source: https://github.com/yuko1101/starrail.js/blob/main/docs/README.md Deploys the built website content without using SSH. Requires specifying the GitHub username via the GIT_USER environment variable for authentication. ```shell $ GIT_USER= yarn deploy ``` -------------------------------- ### Get All Characters List Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Shows how to retrieve a list of all available Honkai: Star Rail characters using the getAllCharacters method. The example demonstrates mapping the list to get character names in English. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); const characters = client.getAllCharacters(); // print character names in language "en" console.log(characters.map(c => c.name.get("en"))); ``` -------------------------------- ### Install StarRail.js via npm without cache Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Installs the latest version of the StarRail.js library using npm, skipping the download of the default cache data. Useful if the cache is managed separately. Requires Node.js 16 or newer. ```sh npm install starrail.js@latest --sr-nocache=true ``` -------------------------------- ### Deploy Website (SSH) - Docusaurus Website - shell Source: https://github.com/yuko1101/starrail.js/blob/main/docs/README.md Deploys the built website content using SSH. This command is often used for deploying to services like GitHub Pages when configured for SSH access. ```shell $ USE_SSH=true yarn deploy ``` -------------------------------- ### Change Cache Directory (Constructor) Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Demonstrates how to change the directory where StarRail.js stores cache data by providing the cacheDirectory option during client initialization. Requires calling cacheDirectorySetup() afterward. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail({ cacheDirectory: "./cache" }); client.cachedAssetsManager.cacheDirectorySetup(); ``` -------------------------------- ### Fetch Player Data by UID Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Demonstrates how to fetch a player's Honkai: Star Rail data using their UID via the fetchUser method. The method returns a Promise that resolves with the user data. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); client.fetchUser(800069903).then(user => { console.log(user); }); ``` -------------------------------- ### Manually Fetch All Cache Contents Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Shows how to manually trigger a fetch and update of all Star Rail cache data. The showFetchCacheLog option can be used to display progress. Returns a Promise. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail({ showFetchCacheLog: true }); // showFetchCacheLog is true by default client.cachedAssetsManager.fetchAllContents(); // returns promise ``` -------------------------------- ### Change Cache Directory (Property) Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Demonstrates how to change the directory where StarRail.js stores cache data by assigning a new path to the cachedAssetsManager.cacheDirectoryPath property after client initialization. Requires calling cacheDirectorySetup() afterward. ```javascript const { StarRail } = require("starrail.js"); // Change the directory to store cache data. // Default directory is node_modules/starrail.js/cache. const client = new StarRail(); client.cachedAssetsManager.cacheDirectoryPath = "./cache"; client.cachedAssetsManager.cacheDirectorySetup(); ``` -------------------------------- ### Activate Auto Cache Updater Source: https://github.com/yuko1101/starrail.js/blob/main/README.md Configures and activates an automatic process to periodically check for and update Star Rail cache data. Options control the initial run, interval, and callback functions for update events. Includes commented-out code for deactivation. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); client.cachedAssetsManager.activateAutoCacheUpdater({ instant: true, // Run the first update check immediately timeout: 60 * 60 * 1000, // 1 hour interval onUpdateStart: async () => { console.log("Updating Star Rail Data..."); }, onUpdateEnd: async () => { client.cachedAssetsManager.refreshAllData(); // Refresh memory console.log("Updating Completed!"); } }); // // deactivate // client.cachedAssetsManager.deactivateAutoCacheUpdater(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.