Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fetchAlbumArt = async (path: string) => {
let model: IAudioMetadata = await parseFile(path);
let img: IPicture[] | undefined = model.common.picture;
if (img !== undefined) {
let imgURL = window.URL.createObjectURL(
new Blob([img[0].data], { type: `image/${img[0].format}` })
);
this.setState({ albumart: imgURL });
} else {
this.setState({ albumart: defaultAlbumArt });
}
};