Files
v3-periphery/test/shared/extractJSONFromURI.ts

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)
}