async function download( url, dest, time ) {
	if ( typeof url === "string" ) {
		url = urlParse( url );
	}
	if ( !url || !url.protocol || !url.host || !url.pathname ) {
		throw new Error( "Invalid download URL" );
	}

	if ( typeof dest === "string" ) {
		dest = {
			dir: dest,
			name: null
		};
	}
	if ( !dest || !dest.dir ) {
		throw new Error( "Invalid directory" );
	}

	// download file path
	const name = dest.name
		|| basename( url.pathname )
		|| `${String( Math.random() ).slice( 2 )}.download`;
	const path = pathResolve( dest.dir, name );

	// try to create download directory
	await mkdirp( dest.dir );

	// download and save
	await downloadPromise( url, path, time );

	return path;
}
Download a file over http(s) and write it to the filesystem
@param {(string|Url)} url
@param {(string|Object)} dest
@param {string?} dest.dir
@param {string?} dest.name
@param {number?} time
@returns {Promise}