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 🙏

© 2025 – Pkg Stats / Ryan Hefner

stowkit-three-loader

v0.1.1

Published

Three.js loader for StowKit asset packs

Downloads

5

Readme

@stowkit/three-loader

Three.js loader for StowKit asset packs. Provides an easy-to-use API for loading meshes, textures, and audio from .stow files into Three.js scenes.

Installation

npm install @stowkit/three-loader three

Usage

Basic Mesh Loading

import * as THREE from 'three';
import { StowKitLoader } from '@stowkit/three-loader';

const loader = new StowKitLoader();
loader.setTranscoderPath('/basis/'); // Path to Basis Universal transcoder

// Load a mesh
const scene = await loader.loadMesh('assets.stow', 'models/character.mesh');
threeScene.add(scene);

Loading Multiple Assets from Same Pack

const loader = new StowKitLoader();
loader.setTranscoderPath('/basis/');

// Open pack once
await loader.openPack('assets.stow');

// Load multiple assets (no need to pass URL again)
const character = await loader.loadMesh('', 'models/character.mesh');
const weapon = await loader.loadMesh('', 'models/weapon.mesh');
const texture = await loader.loadTexture('', 'textures/diffuse.ktx2');

threeScene.add(character);
threeScene.add(weapon);

Loading Textures

const loader = new StowKitLoader();
loader.setTranscoderPath('/basis/');

const texture = await loader.loadTexture('assets.stow', 'textures/wood.ktx2');
material.map = texture;
material.needsUpdate = true;

Loading Audio

const listener = new THREE.AudioListener();
camera.add(listener);

const loader = new StowKitLoader();
const audio = await loader.loadAudio('assets.stow', 'sounds/bgm.ogg', listener);
audio.play();

With Callbacks (Three.js style)

loader.loadMesh(
    'assets.stow',
    'models/tree.mesh',
    (scene) => {
        // onLoad
        threeScene.add(scene);
    },
    (progress) => {
        // onProgress
        console.log('Loading...', progress);
    },
    (error) => {
        // onError
        console.error('Failed to load:', error);
    }
);

Getting Metadata

// Get texture info
const texInfo = loader.getTextureMetadata('textures/wood.ktx2');
console.log(`Texture: ${texInfo.width}x${texInfo.height}`);

// Get audio info
const audioInfo = loader.getAudioMetadata('sounds/bgm.ogg');
console.log(`Duration: ${audioInfo.durationMs}ms`);

Listing Assets

await loader.openPack('assets.stow');
const assets = loader.listAssets();

assets.forEach(asset => {
    console.log(`${asset.name} (${asset.type}): ${asset.dataSize} bytes`);
});

Features

  • Automatic texture loading - Materials with mainTex properties automatically load and apply textures
  • Material schema support - Reads tint colors, texture references, and other material properties
  • KTX2/Basis Universal - Compressed texture support with GPU transcoding
  • Scene hierarchy - Preserves node transforms and parent-child relationships
  • Multi-material meshes - Supports meshes with multiple materials/submeshes
  • Type-safe - Full TypeScript definitions

API Reference

StowKitLoader

Constructor

new StowKitLoader(manager?: THREE.LoadingManager, parameters?: StowKitLoaderParameters)

Methods

setTranscoderPath(path: string): this

Set the path to the Basis Universal transcoder (required for KTX2 textures).

detectSupport(renderer: THREE.WebGLRenderer): this

Detect GPU compressed texture format support.

openPack(url: string): Promise<void>

Open a .stow pack file. Call this once when loading multiple assets from the same pack.

loadMesh(url, assetPath, onLoad?, onProgress?, onError?): Promise<THREE.Group>

Load a mesh asset. Returns a Three.js Group containing the mesh hierarchy.

loadTexture(url, assetPath, onLoad?, onProgress?, onError?): Promise<THREE.CompressedTexture>

Load a texture asset. Returns a Three.js CompressedTexture.

loadAudio(url, assetPath, listener, onLoad?, onProgress?, onError?): Promise<THREE.Audio>

Load an audio asset. Returns a Three.js Audio object.

getTextureMetadata(assetPath): object | null

Get texture metadata (width, height, format, etc.).

getAudioMetadata(assetPath): object | null

Get audio metadata (sample rate, channels, duration).

listAssets(): array

List all assets in the opened pack.

dispose(): void

Clean up resources and free memory.

License

MIT