(modelPath, fileName, fatal = true, options = {})
| 547 | * @throws Will throw an error if the file is not found and `fatal` is true. |
| 548 | */ |
| 549 | export async function getModelText(modelPath, fileName, fatal = true, options = {}) { |
| 550 | const buffer = await getModelFile(modelPath, fileName, fatal, options, false); |
| 551 | if (buffer === null) { |
| 552 | return null; |
| 553 | } |
| 554 | |
| 555 | const decoder = new TextDecoder('utf-8'); |
| 556 | return decoder.decode(/** @type {Uint8Array} */ (buffer)); |
| 557 | } |
| 558 | |
| 559 | /** |
| 560 | * Fetches a JSON file from a given path and file name. |
no test coverage detected