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

tileset

v1.0.1

Published

A TypeScript library for working with 3D Tiles tileset.json files

Readme

tileset

A TypeScript library for working with 3D Tiles tileset.json files. This library provides functionality to parse, validate, and manipulate 3D Tiles datasets.

Installation

npm install tileset

Usage

Parsing a tileset.json

import { Tileset } from 'tileset'; import * as fs from 'fs';

// Read the tileset.json file const jsonContent = fs.readFileSync('path/to/tileset.json', 'utf8');

// Parse the JSON content into a Tileset instance const tileset = Tileset.parse(jsonContent, { validate: true });

// Validate the tileset (if not already validated during parsing) const validationResult = tileset.validate(); if (!validationResult.valid) { console.error('Invalid tileset:', validationResult.errors); }

Creating a new tileset

import { Tileset } from 'tileset';

// Create a basic tileset structure const tilesetData = { asset: { version: '1.1' }, geometricError: 1000.0, root: { boundingVolume: { region: [116.3, 39.9, 116.4, 40.0, 0, 500] }, geometricError: 500.0, children: [ // Add child tiles here ] } };

// Create a Tileset instance from the data const tileset = Tileset.fromObject(tilesetData, { validate: true });

Traversing tiles

// Traverse all tiles tileset.traverse((tile, depth) => { console.log(Depth ${depth}: Tile with geometric error ${tile.geometricError}); });

// Get all tiles in an array const allTiles = tileset.getAllTiles(); console.log(Total tiles: ${allTiles.length});

// Find specific tiles const highDetailTiles = tileset.findAllTiles(tile => tile.geometricError < 100); console.log(High detail tiles: ${highDetailTiles.length});

Exporting the tileset

// Convert to JSON string const jsonOutput = tileset.toJSON(2); // 2 spaces indentation fs.writeFileSync('output/tileset.json', jsonOutput, 'utf8');

// Get the raw object const tilesetObject = tileset.toObject();

API Documentation

Tileset Class

  • static parse(json: string, options?: ParseOptions): Tileset - Parses a JSON string into a Tileset instance
  • static fromObject(data: Tileset, options?: ParseOptions): Tileset - Creates a Tileset instance from an object
  • validate(): ValidationResult - Validates the tileset structure
  • toJSON(space?: number): string - Converts the tileset to a JSON string
  • toObject(): Tileset - Returns a deep copy of the tileset data
  • getRootTile(): Tile - Returns the root tile
  • getAllTiles(): Tile[] - Returns all tiles in an array
  • traverse(callback: (tile: Tile, depth: number) => void) - Traverses all tiles recursively
  • findTile(predicate: (tile: Tile) => boolean): Tile | undefined - Finds the first tile matching the predicate
  • findAllTiles(predicate: (tile: Tile) => boolean): Tile[] - Finds all tiles matching the predicate
  • getTileCount(): number - Returns the total number of tiles
  • getVersion(): string - Returns the 3D Tiles version
  • getProperties(): Record<string, any> | undefined - Returns custom properties
  • setProperties(properties: Record<string, any>): void - Sets custom properties
  • getExtensionsUsed(): string[] | undefined - Returns used extensions
  • addExtension(extension: string): void - Adds an extension to the used extensions list
  • computeOverallBoundingVolume(): BoundingVolume - Computes the overall bounding volume

License

MIT