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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@meshinspector/meshlib-mt

v3.1.3-337

Published

MeshLib geometry library compiled to WebAssembly (multi-threaded).

Readme

@meshinspector/meshlib-mt

MeshLib geometry library compiled to WebAssembly — the multi-threaded build.

This is the higher-throughput sibling of @meshinspector/meshlib (single-threaded). It uses worker threads and SharedArrayBuffer to parallelize geometry operations.

  • Source: https://github.com/MeshInspector/MeshLib
  • Documentation: https://meshlib.io/documentation/index.html

Requirements

  • Node.js >= 21

Install

npm install @meshinspector/meshlib-mt

Use from CDN

In the browser you can skip npm entirely and import the module directly:

// latest version
import createMeshLib from 'https://js.meshlib.io/meshlib-mt/meshlib-mt.mjs';

// or pin a specific version
import createMeshLib from 'https://js.meshlib.io/[email protected]/meshlib-mt.mjs';

Browser requirements: cross-origin isolation

The multi-threaded build relies on SharedArrayBuffer, which browsers only enable on cross-origin isolated pages. Your server must send these headers with the page that loads the module:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

Without them SharedArrayBuffer is unavailable and the module will fail to initialize — use the single-threaded @meshinspector/meshlib package in that case.

For a Vite dev server, set them in vite.config.js (and make sure whatever hosts the production build sends them too; vite-plugin-cross-origin-isolation can stamp them for vite preview):

// vite.config.js
export default {
  server: {
    headers: {
      'Cross-Origin-Opener-Policy': 'same-origin',
      'Cross-Origin-Embedder-Policy': 'require-corp',
    },
  },
};

Usage

The default export is an async factory. Await it once to get the module instance, then call MeshLib functions on it:

import createMeshLib from '@meshinspector/meshlib-mt';

const ml = await createMeshLib();

// Build a cube (side 2) from raw geometry.
const positions = new Float32Array([
  -1, -1, -1,   1, -1, -1,   1, 1, -1,   -1, 1, -1,
  -1, -1,  1,   1, -1,  1,   1, 1,  1,   -1, 1,  1,
]);
const indices = new Uint32Array([
  0, 2, 1,  0, 3, 2,  4, 5, 6,  4, 6, 7,  0, 1, 5,  0, 5, 4,
  3, 6, 2,  3, 7, 6,  0, 4, 7,  0, 7, 3,  1, 2, 6,  1, 6, 5,
]);

const coords = ml.VertCoords.fromArray(positions);
const tris = ml.Triangulation.fromArray(indices);
const mesh = ml.Mesh.fromTriangles(coords, tris);

console.log('volume =', mesh.volume()); // ~8

// Objects are backed by WebAssembly memory — free them explicitly.
coords.delete();
tris.delete();
mesh.delete();

Using with bundlers

Bundlers (Vite, webpack, Rollup) hash and relocate the sidecar meshlib-mt.wasm, so the module can't locate it on its own. Import the wasm as an asset URL and hand it to the loader via locateFile:

import createMeshLib from '@meshinspector/meshlib-mt';
import wasmUrl from '@meshinspector/meshlib-mt/meshlib-mt.wasm?url';

const ml = await createMeshLib( { locateFile: () => wasmUrl } );

The page must also be cross-origin isolated.

TypeScript

The package ships type definitions, so createMeshLib and the whole module API are typed with no extra setup:

import createMeshLib, { type Mesh } from '@meshinspector/meshlib-mt';

const ml = await createMeshLib();
const mesh: Mesh = ml.Mesh.fromTriangles(coords, tris);
const { valid, distSq } = ml.findProjection(point, mesh);

Memory management

Values returned from the API (meshes, bit sets, settings, result objects, …) hold WebAssembly memory that the JavaScript garbage collector does not reclaim. Call .delete() on them when you are done to avoid leaks.

License

Free for non-commercial and educational use. See LICENSE.

For commercial use, contact us at https://meshlib.io/book-a-call/