UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in

22 lines (21 loc) 1.22 kB
/** * The supported file types that can be determined by the engine. Used in {@link tryDetermineFileTypeFromURL} and {@link tryDetermineFileTypeFromBinary} */ export declare type FileType = "gltf" | "glb" | "vrm" | "fbx" | "obj" | "usdz" | "usd" | "usda" | "unknown"; /** * Tries to determine the file type of a file from its URL * This method does perform a range request to the server to get the first few bytes of the file * If the file type can not be determined it will return "unknown" * @param url The URL of the file * @param useExtension If true the file type will be determined by the file extension first - if the file extension is not known it will then check the header * @example * ```typescript * const url = "https://example.com/model.glb"; * const fileType = await tryDetermineFileTypeFromURL(url); * console.log(fileType); // "glb" */ export declare function tryDetermineFileTypeFromURL(url: string, useExtension?: boolean): Promise<FileType>; /** Attempts to determine the file type of a binary file by looking at the first few bytes of the file. * @hidden */ export declare function tryDetermineFileTypeFromBinary(data: ArrayBuffer, response: Response): FileType;