(assetData: AssetData)
| 294 | } |
| 295 | |
| 296 | private async createAssetFromExample(assetData: AssetData) { |
| 297 | const filePath = join(this.assetsDir, assetData.path) |
| 298 | const file = Bun.file(filePath) |
| 299 | if (!(await file.exists())) { |
| 300 | throw new Error(`Example asset file not found: ${filePath}`) |
| 301 | } |
| 302 | const buffer = await file.arrayBuffer() |
| 303 | // We use createAssetFromBuffer which handles saving to data/files and DB creation |
| 304 | return assetService.createAssetFromBuffer(buffer, { |
| 305 | name: assetData.name, |
| 306 | type: assetData.type, |
| 307 | }) |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | export const exampleDataService = new ExampleDataService() |
no test coverage detected