408
409
export function parseMetaData(dataUri: URI): Map<string, string> {
410
>
const metadata = new Map<string, string>();
resources.ts
411
>
412
>
// Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...
413
>
// the metadata is: size:2313;label:SomeLabel;description:SomeDescription
414
>
const meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));
415
>
meta.split(';').forEach(property => {
416
>
const [key, value] = property.split(':');
417
>
if (key && value) {
418
>
metadata.set(key, value);
419
>
}
420
>
});
421
>
422
>
// Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...
423
>
// the mime is: image/png
424
>
const mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));
425
>
if (mime) {
426
metadata.set(META_DATA_MIME, mime);
427
}
429
>
return metadata;
430
>
}
431
}
432