diff --git a/packages/fragments/src/Importers/IfcImporter/src/types.ts b/packages/fragments/src/Importers/IfcImporter/src/types.ts index a5762d4..a593ab9 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,31 @@ 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, 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; progressCallback?: (progress: number, data: ProgressData) => void; }