# @ifc-lite/parser

> IFC/STEP parser for IFC-Lite

Latest version **7.1.0** (published 2026-09-18) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ifc-lite/parser
pnpm add @ifc-lite/parser
yarn add @ifc-lite/parser
bun add @ifc-lite/parser
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 7.1.0 |
| Published | 2026-09-18 |
| First published | 2026-01-12 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 337 |
| Author | Louis True |
| Maintainers | louistrue |
| Keywords | ifc, bim, parser, step, aec |

## Links

- npm: https://www.npmjs.com/package/@ifc-lite/parser
- Repository: https://github.com/LTplus-AG/ifc-lite
- Homepage: https://ifclite.dev/docs/
- Issues: https://github.com/LTplus-AG/ifc-lite/issues
- npm.io page: https://npm.io/package/@ifc-lite/parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 7.1.0 (latest) — 2026-09-18
- 7.0.0 — 2026-09-17
- 6.5.0 — 2026-09-15
- 6.4.0 — 2026-09-14
- 6.3.0 — 2026-09-13
- 6.2.1 — 2026-09-13
- 6.1.0 — 2026-09-12
- 5.2.0 — 2026-09-08
- 5.1.0 — 2026-09-06
- 5.0.0 — 2026-09-04
- 4.3.2 — 2026-08-27
- 4.3.1 — 2026-08-25
- 4.3.0 — 2026-08-24
- 4.2.0 — 2026-08-21
- 4.1.0 — 2026-08-16
- … 80 more at https://npm.io/package/@ifc-lite/parser/versions

## README

# @ifc-lite/parser

High-performance IFC parser. Tokenizes STEP files at high throughput, builds columnar TypedArray storage, and ships full type-safe coverage of all 776 IFC4 entities. IFC2X3, IFC4, and IFC4X3 files are detected and parsed at runtime; IFC5 (IFCX) files are handled via `parseAuto`.

## Installation

```bash
npm install @ifc-lite/parser
```

## Parse a file

```typescript
import { IfcParser } from '@ifc-lite/parser';

const parser = new IfcParser();
const buffer = await fetch('model.ifc').then(r => r.arrayBuffer());

const t0 = performance.now();
const store = await parser.parseColumnar(buffer, {
  onProgress: ({ phase, percent }) => console.log(`${phase}: ${percent.toFixed(1)}%`),
});

console.log(`Parsed ${store.entityCount} entities in ${(performance.now() - t0).toFixed(0)}ms`);
```

`parseColumnar()` is the canonical STEP parser. It uses TypedArray-backed storage,
shared scan selection, and on-demand extraction for properties, quantities,
materials, classifications, documents, and attributes.

```typescript
const store = await parser.parseColumnar(buffer);

// store.entities    - typed access by expressId
// store.properties  - flattened pset table
// store.quantities  - flattened qset table
// store.spatialHierarchy.byStorey  - Map<storeyId, elementIds[]>
console.log(`${store.entityCount} entities, schema ${store.schemaVersion}`);
```

To handle IFC5 (IFCX) files with the same entry point, use `parseAuto`:

```typescript
import { parseAuto } from '@ifc-lite/parser';

const result = await parseAuto(buffer);
// result.format is 'ifc' (STEP -> IfcDataStore) or 'ifcx' (JSON -> IfcxParseResult + meshes)
```

## Type-safe entity access

All 776 IFC4 entities ship as TypeScript types via the generated schema.

```typescript
import type { IfcWall, IfcDoor, IfcSlab } from '@ifc-lite/parser';
import { isKnownEntity, getEntityMetadata } from '@ifc-lite/parser';

// Schema metadata
const meta = getEntityMetadata('IfcWall');
console.log(meta.parent);              // 'IfcBuildingElement'
console.log(meta.inheritanceChain);    // ['IfcRoot', ..., 'IfcWall']
console.log(meta.allAttributes);       // every attribute including inherited

// Schema membership check
console.log(isKnownEntity('IfcWall'));     // true
console.log(isKnownEntity('IfcWidget'));   // false
```

## On-demand property extraction

Properties and quantities are extracted lazily — pay only for what you read.

```typescript
import {
  extractPropertiesOnDemand,
  extractQuantitiesOnDemand,
  extractMaterialsOnDemand,
  extractClassificationsOnDemand,
} from '@ifc-lite/parser';

const wallId = 12345;

const psets = extractPropertiesOnDemand(store, wallId);
//   [{ name: 'Pset_WallCommon', properties: [{ name: 'FireRating', value: 'REI 60' }, ...] }]

const qsets = extractQuantitiesOnDemand(store, wallId);
//   [{ name: 'Qto_WallBaseQuantities', quantities: [{ name: 'Length', value: 5.0 }, ...] }]

const material = extractMaterialsOnDemand(store, wallId);
//   { name: 'Concrete C30/37', layers: [{ name: 'Concrete', thickness: 0.15 }, ...] }

const classifications = extractClassificationsOnDemand(store, wallId);
//   [{ system: 'Uniclass 2015', identification: 'Pr_60_10_32', name: 'External walls', ... }]
```

## Georeferencing

```typescript
import { extractGeoreferencingOnDemand } from '@ifc-lite/parser';

const georef = extractGeoreferencingOnDemand(store);

if (georef?.hasGeoreference) {
  console.log(`CRS: ${georef.projectedCRS?.name}`);
  console.log(`Origin: ${georef.mapConversion?.eastings}, ${georef.mapConversion?.northings}, ${georef.mapConversion?.orthogonalHeight}`);
  console.log(`Grid north: ${georef.mapConversion?.xAxisAbscissa}, ${georef.mapConversion?.xAxisOrdinate}`);
}
```

## Read cost data

```typescript
import { evaluateCostItem, extractCostOnDemand } from '@ifc-lite/parser';

const cost = extractCostOnDemand(store);
const result = evaluateCostItem(cost, cost.CostItems[0].expressId);
console.log(result.Amount, result.Currency, result.Diagnostics);
```

The read model preserves ordered `CostValues`, direct `CostQuantities`, shared
references, and the original `IfcRelNests`/assignment relationship endpoints.
Rates use only `IfcCostItem.CostQuantities`; product Qto values are never used as
an implicit fallback. Direct quantities make the item's values unit costs even
when `UnitBasis` is absent. IFC4 and IFC4X3 support exact-decimal arithmetic,
currencies, compatible `UnitBasis` conversion, and named or `*` nested-category
totals. Invalid quantities or incompatible dimensions produce diagnostics and
withhold the total instead of returning a partial result. IFC2X3 cost metadata and legacy
relationships remain inspectable, with an explicit partial-read diagnostic;
IFC2X3 evaluation is intentionally unsupported.

## Performance

| Model size | Parse time |
|---:|---:|
| 10 MB | ~100–200 ms |
| 50 MB | ~600–700 ms |
| 200 MB | ~2.5–3 s |

- Tokenization: high single-pass throughput on M1/M2 laptops
- Bundle: ~200 KB gzipped (schema registry included)
- Memory: TypedArray columnar storage

## API

See the [Parsing Guide](https://ifclite.dev/docs/guide/parsing/) and [API Reference](https://ifclite.dev/docs/api/typescript/#ifc-liteparser).

## License

[MPL-2.0](../../LICENSE)

---
_Source: https://npm.io/package/@ifc-lite/parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
