async download(context, payload) {
			const filename = (payload instanceof Object) ? payload.filename : payload;
			const type = (payload instanceof Object) ? payload.type : 'auto';
			const showProgress = (payload instanceof Object) ? !!payload.showProgress : true;
			const showSuccess = (payload instanceof Object) ? !!payload.showSuccess : true;
			const showError = (payload instanceof Object) ? !!payload.showError : true;
			const num = (payload instanceof Object) ? payload.num : undefined;
			const count = (payload instanceof Object) ? payload.count : undefined;

			const cancelSource = BaseConnector.getCancelSource();
			const notification = showProgress && makeFileTransferNotification('download', filename, cancelSource, num, count);
			try {
				const startTime = new Date();
				const response = await connector.download({ filename, type, cancelSource, onProgress: notification && notification.onProgress });

				// Show success message
				if (showSuccess && num === count) {
					if (count) {
						log('success', i18n.t('notification.download.successMulti', [count]), undefined, hostname);
					} else {
						const secondsPassed = Math.round((new Date() - startTime) / 1000);
						log('success', i18n.t('notification.download.success', [Path.extractFileName(filename), displayTime(secondsPassed)]), undefined, hostname);
					}
				}

				// Return the downloaded data
				if (showProgress) {
					notification.hide();
				}
				return response;
			} catch (e) {
				// Show and report error message
				if (showProgress) {
					notification.hide();
				}
				if (showError && !(e instanceof OperationCancelledError)) {
					console.warn(e);
					log('error', i18n.t('notification.download.error', [Path.extractFileName(filename)]), e.message, hostname);
				}
				throw e;
			}
		}
// Parameter can be either the filename or an object { filename, (type, showProgress, showSuccess, showError, num, count) }
Parameter can be either the filename or an object { filename, (type, showProgress, showSuccess, showError, num, count) }
Parameter can be either the filename or an object { filename ( type showProgress showSuccess showError num count ) }
async download(context, payload) {
			const filename = (payload instanceof Object) ? payload.filename : payload;
			const type = (payload instanceof Object) ? payload.type : 'auto';
			const showProgress = (payload instanceof Object) ? !!payload.showProgress : true;
			const showSuccess = (payload instanceof Object) ? !!payload.showSuccess : true;
			const showError = (payload instanceof Object) ? !!payload.showError : true;
			const num = (payload instanceof Object) ? payload.num : undefined;
			const count = (payload instanceof Object) ? payload.count : undefined;
			const cancelSource = BaseConnector.getCancelSource();
			const notification = showProgress && makeFileTransferNotification('download', filename, cancelSource, num, count);
			try {
				const startTime = new Date();
				const response = await connector.download({ filename, type, cancelSource, onProgress: notification && notification.onProgress });
				if (showSuccess && num === count) {
					if (count) {
						log('success', i18n.t('notification.download.successMulti', [count]), undefined, hostname);
					} else {
						const secondsPassed = Math.round((new Date() - startTime) / 1000);
						log('success', i18n.t('notification.download.success', [Path.extractFileName(filename), displayTime(secondsPassed)]), undefined, hostname);
					}
				}
				if (showProgress) {
					notification.hide();
				}
				return response;
			} catch (e) {
				if (showProgress) {
					notification.hide();
				}
				if (showError && !(e instanceof OperationCancelledError)) {
					console.warn(e);
					log('error', i18n.t('notification.download.error', [Path.extractFileName(filename)]), e.message, hostname);
				}
				throw e;
			}
		}
async download ( context , payload ) { const filename = ( payload instanceof Object ) ? payload . filename : payload ; const type = ( payload instanceof Object ) ? payload . type : 'auto' ; const showProgress = ( payload instanceof Object ) ? ! ! payload . showProgress : true ; const showSuccess = ( payload instanceof Object ) ? ! ! payload . showSuccess : true ; const showError = ( payload instanceof Object ) ? ! ! payload . showError : true ; const num = ( payload instanceof Object ) ? payload . num : undefined ; const count = ( payload instanceof Object ) ? payload . count : undefined ; const cancelSource = BaseConnector . getCancelSource ( ) ; const notification = showProgress && makeFileTransferNotification ( 'download' , filename , cancelSource , num , count ) ; try { const startTime = new Date ( ) ; const response = await connector . download ( { filename , type , cancelSource , onProgress : notification && notification . onProgress } ) ; if ( showSuccess && num === count ) { if ( count ) { log ( 'success' , i18n . t ( 'notification.download.successMulti' , [ count ] ) , undefined , hostname ) ; } else { const secondsPassed = Math . round ( ( new Date ( ) - startTime ) / 1000 ) ; log ( 'success' , i18n . t ( 'notification.download.success' , [ Path . extractFileName ( filename ) , displayTime ( secondsPassed ) ] ) , undefined , hostname ) ; } } if ( showProgress ) { notification . hide ( ) ; } return response ; } catch ( e ) { if ( showProgress ) { notification . hide ( ) ; } if ( showError && ! ( e instanceof OperationCancelledError ) ) { console . warn ( e ) ; log ( 'error' , i18n . t ( 'notification.download.error' , [ Path . extractFileName ( filename ) ] ) , e . message , hostname ) ; } throw e ; } }
Parameter can be either the filename or an object { filename, (type, showProgress, showSuccess, showError, num, count) }
Parameter can be either the filename or an object { filename ( type showProgress showSuccess showError num count ) }
// Show success message // Return the downloaded data // Show and report error message