Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
zip.generateAsync({ type: 'base64' }).then((base64: string) => {
new Downloader({
url: 'data:application/zip;base64,' + base64,
filename: 'block-photos.zip'
})
.then(() => {
// Called when download ended
this.downloadInProgress = false;
})
.catch(error => {
// Called when an error occurred
console.error(error);
this.downloadInProgress = false;
this.present.toast('Downloading of the photo failed!');
});
});
}
async downloadOriginal(event: MouseEvent): Promise {
event.preventDefault();
this.downloadInProgress = true;
new Downloader({
url: this.photo.source,
filename: this.photo.metadata.filename
})
.then(() => {
// Called when download ended
this.downloadInProgress = false;
})
.catch(error => {
// Called when an error occurred
console.error(error);
this.downloadInProgress = false;
this.present.toast('Downloading of the photo failed!');
});
}
async downloadOriginal(event: MouseEvent): Promise {
event.preventDefault();
this.downloadInProgress = true;
const metadata: PhotoMetadata = await PhotosService.getPhotoMetaData(
this.photoId
);
const data = await PhotosService.loadPhoto(metadata, PhotoType.Download);
new Downloader({
url: data,
filename: metadata.filename
})
.then(() => {
// Called when download ended
this.downloadInProgress = false;
})
.catch(error => {
// Called when an error occurred
console.error(error);
this.downloadInProgress = false;
this.present.toast('Downloading of the photo failed!');
});
}