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

@ifc-lite/wasm

v1.16.10

Published

WebAssembly bindings for IFC-Lite

Readme

@ifc-lite/wasm

Pre-built WebAssembly bindings for the IFClite Rust core. ~650 KB binary (~260 KB gzipped) covering STEP parsing, geometry tessellation, georeferencing, and zero-copy GPU upload.

You probably don't need to use this package directly. It's the WASM binary plus generated JS/TypeScript bindings that @ifc-lite/parser, @ifc-lite/geometry, and @ifc-lite/renderer consume internally. Reach for it when you want raw access to the Rust core without the higher-level wrappers.

Installation

npm install @ifc-lite/wasm

Direct WASM use

IfcAPI methods take the raw IFC text (a string), not a Uint8Array. Decode the buffer first.

import init, { IfcAPI } from '@ifc-lite/wasm';

await init();                         // load and instantiate the WASM module

const api = new IfcAPI();
const buffer = await fetch('model.ifc').then(r => r.arrayBuffer());
const content = new TextDecoder().decode(buffer);

// Lightweight parse — returns { entityCount, ... }
const result = await api.parse(content);
console.log(`Entities: ${result.entityCount}`);

// Tessellated meshes — each entry has expressId, positions, indices, normals, color
const meshes = api.parseMeshes(content);
console.log(`${meshes.length} meshes`);
for (let i = 0; i < meshes.length; i++) {
  const mesh = meshes.get(i);
  console.log(mesh.ifcType, mesh.expressId, mesh.vertexCount, 'vertices');
}

meshes.free();                        // free the Rust-side mesh buffer
api.free();                           // free the API instance

Streaming mesh batches

For progressive rendering, stream meshes in batches and yield to the browser between them:

import init, { IfcAPI } from '@ifc-lite/wasm';

await init();
const api = new IfcAPI();

await api.parseMeshesAsync(content, {
  batchSize: 100,
  onRtcOffset: ({ x, y, z, hasRtc }) => {
    if (hasRtc) viewer.setWorldOffset(x, y, z);
  },
  onBatch: (meshes, progress) => {
    for (const mesh of meshes) scene.add(toThreeMesh(mesh));
    console.log(`${progress.percent}%`);
  },
  onComplete: ({ totalMeshes }) => console.log(`Done — ${totalMeshes} meshes`),
});

Zero-copy GPU upload

parseToGpuGeometry returns interleaved (position + normal) vertex data with pointers into WASM linear memory, ready for direct GPUBuffer upload:

import init, { IfcAPI } from '@ifc-lite/wasm';

await init();
const api = new IfcAPI();
const gpuGeom = api.parseToGpuGeometry(content);
const memory = api.getMemory();

// Direct views into WASM memory — no intermediate copy
const vertexView = new Float32Array(memory.buffer, gpuGeom.vertexDataPtr, gpuGeom.vertexDataLen);
const indexView = new Uint32Array(memory.buffer, gpuGeom.indicesPtr, gpuGeom.indicesLen);

device.queue.writeBuffer(gpuVertexBuffer, 0, vertexView);
device.queue.writeBuffer(gpuIndexBuffer, 0, indexView);

// IMPORTANT: views are only valid until the next WASM allocation. Free immediately after upload.
gpuGeom.free();

For deduplicated geometry (one mesh per shape, per-instance transforms), use parseToGpuInstancedGeometry(content) and iterate GpuInstancedGeometryCollection.

Georeferencing

import init, { IfcAPI } from '@ifc-lite/wasm';

await init();
const api = new IfcAPI();
const georef = api.getGeoReference(content);

if (georef) {
  console.log(`CRS: ${georef.crsName}`);
  const [e, n, h] = georef.localToMap(10, 20, 5);
  console.log(`Local (10,20,5) → Map (${e}, ${n}, ${h})`);
  georef.free();
}

Exports

| Class | Purpose | |---|---| | IfcAPI | Top-level parser entry point — parse, parseMeshes, parseMeshesAsync, parseToGpuGeometry, parseZeroCopy, getGeoReference, extractProfiles, parseSymbolicRepresentations, … | | MeshCollection, MeshDataJs | Tessellated geometry output | | MeshCollectionWithRtc, RtcOffsetJs | Mesh collection with relative-to-centre offset for large-coordinate models | | InstancedMeshCollection, InstancedGeometry, InstanceData | Instanced geometry path (deduplicated meshes + per-instance transforms) | | ZeroCopyMesh, GpuGeometry, GpuMeshMetadata | Zero-copy GPU upload handles | | GpuInstancedGeometry, GpuInstancedGeometryCollection, GpuInstancedGeometryRef | Zero-copy instanced path | | GeoReferenceJs | Georeferencing transform | | ProfileCollection, ProfileEntryJs | Cross-section profile data (extruded-area solids) | | SymbolicRepresentationCollection, SymbolicCircle, SymbolicPolyline | 2D symbolic representations (for plan / annotation views) |

All classes implement free() and [Symbol.dispose]() — call free() (or use using) to release Rust-side memory.

When to use a higher-level package instead

| You want… | Use | |---|---| | A typed, idiomatic TS API for parsing | @ifc-lite/parser | | Streaming geometry with worker support | @ifc-lite/geometry | | WebGPU rendering | @ifc-lite/renderer | | To avoid managing WASM lifecycles by hand | Any of the above |

Rust source

This package ships the bindings only. The Rust source lives in rust/wasm-bindings/ and the core in rust/core/. Available on crates.io as ifc-lite-core.

API

See the WASM API Reference.

License

MPL-2.0