STEP file parser for JavaScript/TypeScript, powered by OpenCascade and Rust/WASM
npm install step-parserA high-performance STEP file parser for JavaScript/TypeScript, powered by OpenCascade and Rust/WebAssembly.
- 🚀 Fast STEP file parsing using OpenCascade
- 📦 Compiled to WebAssembly for near-native performance
- 🔒 Type-safe API with TypeScript definitions
- 🌐 Works in browsers and Node.js
- 📐 Extracts complete B-Rep geometry (Solids, Faces, Wires, Edges)
``bash`
npm install step-parser
`typescript
import { initStepParser, parseStep } from 'step-parser';
// Initialize the WASM module (do this once)
await initStepParser();
// Load STEP file
const response = await fetch('model.step');
const stepBytes = new Uint8Array(await response.arrayBuffer());
// Parse STEP file
const geometry = parseStep(stepBytes);
console.log(Parsed ${geometry.solids.length} solids); Solid has ${solid.faces.length} faces
for (const solid of geometry.solids) {
console.log();`
}
`typescript
import { readFileSync } from 'fs';
import { initStepParser, parseStep } from 'step-parser';
// Initialize WASM module
await initStepParser();
// Load and parse STEP file
const stepBytes = readFileSync('model.step');
const geometry = parseStep(stepBytes);
`
Initialize the WASM module. Must be called before parsing any STEP files.
Options:
- locateFile?: (path: string) => string` - Custom function to locate WASM file (optional)
Parse a STEP file and return the result as a typed object.
Check if the WASM module has been initialized.