Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions packages/fragments/src/Importers/IfcImporter/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { ModelLoadCallback } from "web-ifc";

export interface ProgressData {
process: "geometries" | "attributes" | "relations" | "conversion";
state: "start" | "inProgress" | "finish";
Expand All @@ -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;
}