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

@draco-rust/encoder

v0.3.0

Published

Draco geometry encoder in WebAssembly, a safe Rust port of Google Draco: compresses meshes and point clouds to .drc.

Readme

@draco-rust/encoder

Encodes meshes and point clouds to Draco (.drc) in WebAssembly. It is part of draco-rust, a safe Rust port of Google's Draco, and with default options writes the same bytes as Google's encoder. It is not affiliated with Google. To decode, use @draco-rust/decoder.

~133 KiB gzip.

Usage

import init, { encode_draco } from "@draco-rust/encoder";

await init();
const result = encode_draco(
  { positions, indices, normals, uvs, colors },  // typed arrays; all but positions optional
  { position_bits: 14, normal_bits: 10, texcoord_bits: 12, encoding_speed: 5, decoding_speed: 5 },
);
if (!result.success) throw new Error(result.error);
const drc = result.bytes; // Uint8Array

positions is a Float32Array of xyz triples and indices a Uint32Array of triangle corners. Leave indices out, or set point_cloud: true, to write a point cloud. Two options act on point clouds only:

  • prediction_search chooses each attribute's prediction by its estimated cost.
  • spatial_point_order orders the points along a Hilbert curve.

Both write smaller files, at the cost of output no longer byte-identical to Google's encoder.

On workers

@draco-rust/encoder/pool encodes on workers, so a large mesh does not block the calling thread:

import { createPool } from "@draco-rust/encoder/pool";

const pool = createPool({ workers: 2 });
const result = await pool.encode(mesh, { position_bits: 14 }); // what encode_draco returns
pool.dispose();

The workers start as work arrives, and the wasm is compiled once for all of them. Inputs are copied to the worker, or handed over with { transfer: true }; { signal } takes an AbortSignal, which rejects the promise at once. A task a worker has started still runs to its end and its result is dropped. With workers: 0, or where there are no workers, the pool runs on the calling thread. It works on Web Workers, Node's worker threads (Node 20.16 and later) and from a CDN, as the decoder's does.

For loading from a CDN or in Node, see the decoder's README; the same init options apply, with @draco-rust/encoder/index_bg.wasm as the file.

Licensed under Apache-2.0, like Draco.

This build

@draco-rust/[email protected] was built from draco-rust commit 4b72cfc8, with draco-core 2.3.2, draco-io 0.6.0, draco-gltf 0.7.0.