From 4a20be9ccf98452dbed4a1d978cd82e33cbe2941 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Sun, 22 Mar 2026 09:47:31 +0200 Subject: [PATCH 1/2] fix(TS): `ProcessData#readCallback` --- .../src/Importers/IfcImporter/src/types.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/fragments/src/Importers/IfcImporter/src/types.ts b/packages/fragments/src/Importers/IfcImporter/src/types.ts index a5762d4..75ee09f 100644 --- a/packages/fragments/src/Importers/IfcImporter/src/types.ts +++ b/packages/fragments/src/Importers/IfcImporter/src/types.ts @@ -1,3 +1,5 @@ +import type { ModelLoadCallback } from "web-ifc"; + export interface ProgressData { process: "geometries" | "attributes" | "relations" | "conversion"; state: "start" | "inProgress" | "finish"; @@ -7,9 +9,16 @@ export interface ProgressData { export interface ProcessData { id?: string; - readFromCallback?: boolean; bytes?: Uint8Array; - readCallback?: any; + /** + * @see {@link readCallback} + * @default false + */ + readFromCallback?: boolean; + /** + * Read ifc file incrementally, use instead of passing {@link bytes} + */ + readCallback?: ModelLoadCallback; raw?: boolean; progressCallback?: (progress: number, data: ProgressData) => void; } From 26e114d423c611fc92a69a21de51d1a5d7947f0b Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Sun, 22 Mar 2026 10:58:27 +0200 Subject: [PATCH 2/2] jsdoc example --- .../src/Importers/IfcImporter/src/types.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/fragments/src/Importers/IfcImporter/src/types.ts b/packages/fragments/src/Importers/IfcImporter/src/types.ts index 75ee09f..a593ab9 100644 --- a/packages/fragments/src/Importers/IfcImporter/src/types.ts +++ b/packages/fragments/src/Importers/IfcImporter/src/types.ts @@ -16,7 +16,22 @@ export interface ProcessData { */ readFromCallback?: boolean; /** - * Read ifc file incrementally, use instead of passing {@link bytes} + * Read ifc file incrementally, instead of passing {@link bytes}. + * + * @example node.js + * ```typescript + * import { open } from "node:fs/promises"; + * + * const handle = await open(filePath, "r"); + * const chunkSize = 64 * 1024; // 64KB + * const buffer = new Uint8Array(chunkSize); + * const readCallback: ((offset: number) => { + * const bytesRead = readSync(handle.fd, buffer, 0, chunkSize, offset); + * return buffer.slice(0, bytesRead); + * }) + * const output = await importer.process({ readFromCallback: true, readCallback }); + * await handle.close(); + * ``` */ readCallback?: ModelLoadCallback; raw?: boolean;