npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

starlightskinapi

v1.0.10

Published

Starlight SkinAPI Wrapper

Downloads

24

Readme

Starlight SkinAPI Wrapper

This package is a Starlight SkinAPI wrapper

Oficial Starlight SkinAPI Documentation : https://docs.lunareclipse.studio/

Installation

npm install starlightskinapi

fetchSkinInfo function usage:

import { fetchSkinInfo } from "starlightskinapi";

async function main(){
    const playerNickname = "RinckoZ_";
    const infoResult = await fetchSkinInfo(playerNickname)

    if (infoResult.success){
        console.log(infoResult.playerUUID)
        console.log(infoResult.skinUrl)
        console.log(infoResult.userCape)
        console.log(infoResult.skinTextureWidth)
        console.log(infoResult.skinTextureHeight)
    }
}
main();

Output:

f169e30f110943dfba445da3b7dee1ce
http://textures.minecraft.net/texture/4d24cc4874ba673963ca57818a0be02666aa80f4747d00b45571e380ed9b54f7
http://textures.minecraft.net/texture/2340c0e03dd24a11b15a8b33c2a7e9e32abb2051b2481d0ba7defd635ca7a933
64
64

If the nick or uuid is not found, success will be false, and you will have the error property

async function main(){
    const playerNickname = "NicknameVeryLongAndUnlikely";
    const infoResult = await fetchSkinInfo(playerNickname)

    if (!infoResult.success){
        console.log(infoResult.error)
    }
}
main();

Output:

Unknown player username/uuid.

See how to get a render pose

import { RenderCrops, RenderTypes, fetchSkinRender } from "starlightskinapi";
import { writeFile } from "node:fs/promises"

async function main(){
    const playerNickname = "RinckoZ_";
    const renderResult = await fetchSkinRender(playerNickname, {
        type: RenderTypes.Default,
        crop: RenderCrops.Full,
    })

    if (!renderResult.success){
        console.log(renderResult.error)
        return;
    }

    if (renderResult.success){
        const { buffer, url } = renderResult;
        console.log(url) // 
        await writeFile("./render.png", buffer);
    }
}
main();

Output:

You can customize the model, camera and lighting options

import { RenderCrops, RenderTypes, fetchSkinRender } from "starlightskinapi";
import { writeFile } from "node:fs/promises"

async function main(){
    const playerNickname = "RinckoZ_";

    const renderResult = await fetchSkinRender(playerNickname, {
        type: RenderTypes.Default,
        crop: RenderCrops.Full,
        model: {
            capeEnabled: true,
            // ... other model options ...
        },
        camera: {
            cameraPosition: { x: "10", y: "10", z: "-20" },
            cameraWidth: 720,
            cameraHeight: 1080,
            // ... other camera options ...
        },
        lighting: {
            dirLightPos: { x: "-10", y: "10", z: "-10" },
            // ... other lighting options ...
        },
    });

    if (!renderResult.success){
        console.log(renderResult.error)
        return;
    }

    if (renderResult.success){
        const { buffer } = renderResult;
        await writeFile("./customized.png", buffer);
    }
}
main();

Output:

Full Render Type List

| Render Types | Supported Crops | Preview | | ------------ | --------------- | ------- | | Default | Full, Bust, Face | | | Marching | Full, Bust, Face | | | Walking | Full, Bust, Face | | | Crouching | Full, Bust, Face | | | Crossed | Full, Bust, Face | | | CrissCross| Full, Bust, Face | | | Cheering| Full, Bust, Face | | | Relaxing| Full, Bust, Face | | | Trudging | Full, Bust, Face | | | Cowering| Full, Bust, Face | | | Pointing| Full, Bust, Face | | | Lunging| Full, Bust, Face | | | Dungeons| Full, Bust, Face | | | Facepalm| Full, Bust, Face | | | Sleeping| Full, Bust | | | Dead| Full, Bust, Face | | | Archer| Full, Bust, Face | | | Facepalm| Full, Bust, Face | | | Mojavatar| Full, Bust | | | Ultimate| Full, Bust, Face | | | Isometric| Full, Bust, Face | | | Head| Full | | | Bitzel| Full, Bust, Face | | | Pixel| Full, Bust, Face | | | Ornament| Full | | | Skin| Default, Processed | |