infrastructure-upgrade/lib/v3-periphery/test/shared/extractJSONFromURI.ts
T-Hax 735546619e
init
Signed-off-by: T-Hax <>
2023-04-08 18:46:18 +00:00

6 lines
286 B
TypeScript

export function extractJSONFromURI(uri: string): { name: string; description: string; image: string } {
const encodedJSON = uri.substr('data:application/json;base64,'.length)
const decodedJSON = Buffer.from(encodedJSON, 'base64').toString('utf8')
return JSON.parse(decodedJSON)
}