MCPcopy Create free account
hub / github.com/Yiling-J/forgery / createAssetFromExample

Method createAssetFromExample

src/service/example-data.ts:296–308  ·  view source on GitHub ↗
(assetData: AssetData)

Source from the content-addressed store, hash-verified

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
311export const exampleDataService = new ExampleDataService()

Callers 1

importMethod · 0.95

Calls 1

createAssetFromBufferMethod · 0.80

Tested by

no test coverage detected