Overview
Typed, import-once 3D format conversion in Node.js, browsers, and workers.
libassimp compiles the Open Asset Import Library to WebAssembly behind a typed TypeScript API. It converts files; it does not expose a retained scene graph or a Wasm handle.
What it costs to ship
- Wasm
- 2.1 MB
- JS API
- 0.4 KB
The single root entry has one glue file and one libassimp.wasm file, and publishes its exact static format graph without loading either artifact.
Import once, export many
npm install libassimpimport { convertFormats } from 'libassimp';
import { readFile, writeFile } from 'node:fs/promises';
const bytes = new Uint8Array(await readFile('cube.obj'));
const [glb, stl] = await convertFormats(
{ name: 'cube.obj', bytes },
{
targets: [{ to: 'glb' }, { to: 'stl', exportOptions: { binary: true } }],
},
);
await writeFile(glb.files[0].name, glb.files[0].bytes);
await writeFile(stl.files[0].name, stl.files[0].bytes);The source is imported and post-processed once. Results map positionally to the target tuple, exports run sequentially, and any failure rejects without exposing partial output. Use singular convert when only one output is needed or when you want to persist and release outputs one at a time.
Typed importOptions, postProcess, and format-specific exportOptions reject invalid configuration before Wasm work. A Promise-returning resolve callback can fetch sidecars on demand on every supported host.