Warning
This project is in early development. The API may change before a stable 1.0 release. Use with caution in production.
A browser-first 3MF parser for TypeScript projects that uses SAX-style XML parsing internally and WebWorker parallelism to keep large archive parsing efficient.
- 🚀 Streaming-Oriented Parsing - Uses SAX-style XML parsing internally to keep memory usage lower on large 3MF archives
- ⚡ WebWorker Parallelism - Parses model parts across WebWorkers with an auto-sized worker pool
- 📦 Benchmark-Backed Efficiency - Ships measured optimizations for large texture-heavy and component-heavy fixtures
- 🛠 Stable TypeScript Surface - Exports
Fast3MFLoader,fast3mfBuilder, and the documented helper types - 🌐 Browser-First Runtime - Targets modern browsers with
WorkerandBlobsupport
npm install fast-3mf-loader
# or
yarn add fast-3mf-loaderimport { Fast3MFLoader, fast3mfBuilder } from "fast-3mf-loader";
// Get file using fetch
const response = await fetch("path/to/model.3mf");
const buffer = await response.arrayBuffer();
// Parse 3MF file
const loader = new Fast3MFLoader();
const data3mf = await loader.parse(buffer, {
onProgress(progress) {
console.log(`Parsing progress: ${progress}%`);
},
});
const group = fast3mfBuilder(data3mf);
console.log("Parsing result:", group);Parses 3MF file and returns model data.
Parameters:
data: 3MF file data,ArrayBuffer. Other input types are rejected with a loader-facing error.options: Optional configuration objectworkerCount: number - Number of WebWorkers to use. Defaults to an auto-detected value based on available runtime concurrency, with a safe fallback. Invalid values warn and fall back to the default strategy.onProgress: (progress: number) => void - Progress callback function
Return Value:
Promise that resolves to Model3MF. The package exports Model3MF as a documentation-friendly alias of ParseResult, plus the related helper types ParseOptions, ParsedModelPart, and Relationship.
import type {
Model3MF,
ParseOptions,
ParsedModelPart,
Relationship,
} from "fast-3mf-loader";
type Model3MF = {
rels: Relationship[];
modelRels?: Relationship[];
model: Record<string, ParsedModelPart>;
printTicket: Record<string, never>;
texture: Record<string, ArrayBuffer>;
};Use fast3mfBuilder(data3mf) to convert the parsed data into a THREE.Group.
Current support is documented in docs/support-matrix.md.
| Feature | Status | Notes |
|---|---|---|
| Base materials | Supported | Built into Three.js materials |
| Texture groups | Supported | Covered by multipletextures.3mf |
| Vertex colors | Supported | Covered by vertexcolors.3mf |
| Components | Supported | Covered by truck.3mf |
| Print tickets | Not yet supported | Parser returns an empty object and warns |
Current support is defined by fixture-backed behavior and documented in docs/support-matrix.md. Unsupported features, including print tickets and extension resources beyond current fixture coverage, should be treated as unsupported until explicitly documented otherwise.
Benchmarks are collected with npm run build && npm run benchmark.
The current procedure and sample results are documented in docs/benchmarking.md. Those numbers were collected with node scripts/benchmark.mjs on Apple Silicon / Node 22 and should be treated as reproducible samples rather than universal guarantees.
Supports all modern browsers (Chrome, Firefox, Safari, Edge, etc.) and environments that support WebWorker and Blob API.
- Designed for modern browsers with
WorkerandBlobsupport - If the runtime cannot initialize inline workers, parsing fails with a loader-facing error that points back to the
Worker/Blobprerequisite workerCountdefaults tomin(hardwareConcurrency - 1, 15)with a safe fallback of4- Invalid
workerCountvalues warn and fall back to the default worker strategy - Unsupported features currently warn instead of silently pretending to succeed
# Clone repository
git clone https://github.com/Innovgame/fast-3mf-loader.git
# Install dependencies
npm install
# Development mode, develop test page
npm run dev
# Build production version
npm run build
# Run tests
npm testIssues and Pull Requests are welcome! Please ensure you follow the project's code style and test coverage requirements.