Function
resolveResourceContent
(
uri: string,
content: typeof ReadResourceResult.Type | string | Uint8Array
)
Source from the content-addressed store, hash-verified
| 1344 | } |
| 1345 | |
| 1346 | const resolveResourceContent = ( |
| 1347 | uri: string, |
| 1348 | content: typeof ReadResourceResult.Type | string | Uint8Array |
| 1349 | ): typeof ReadResourceResult.Type => { |
| 1350 | if (typeof content === "string") { |
| 1351 | return { |
| 1352 | contents: [ |
| 1353 | { |
| 1354 | uri, |
| 1355 | text: content |
| 1356 | } |
| 1357 | ] |
| 1358 | } |
| 1359 | } else if (content instanceof Uint8Array) { |
| 1360 | return { |
| 1361 | contents: [ |
| 1362 | { |
| 1363 | uri, |
| 1364 | blob: content |
| 1365 | } |
| 1366 | ] |
| 1367 | } |
| 1368 | } |
| 1369 | return content |
| 1370 | } |
Tested by
no test coverage detected