( sourceFile: File )
| 17 | } |
| 18 | |
| 19 | export async function getSplatMeshSourceOptions( |
| 20 | sourceFile: File |
| 21 | ): Promise<Pick<SplatMeshOptions, 'fileBytes' | 'stream' | 'streamLength'>> { |
| 22 | if (!isSplatFilePath(sourceFile.name)) { |
| 23 | throw new Error(`Unsupported splat format: ${sourceFile.name}`); |
| 24 | } |
| 25 | |
| 26 | if (typeof sourceFile.stream === 'function') { |
| 27 | return { |
| 28 | stream: sourceFile.stream(), |
| 29 | streamLength: sourceFile.size, |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | const fileBytes = await sourceFile.arrayBuffer(); |
| 34 | return { |
| 35 | fileBytes: new Uint8Array(fileBytes), |
| 36 | }; |
| 37 | } |
no test coverage detected