lbry-desktop/ui/util/downloadClaim.js
infinite-persistence fbcb740dc9 Move 'Download' and 'Report Content' into overflow menu.
## Issue
6236 Add context menu to file page

## Notes
The download button actually handles a lot of things -- generating 'streamingUrl', differences between Web and Desktop, download progress for Desktop, etc.  A simpler fix would be to put something else (maybe "Share") into the overflow menu instead.

Anyway, went ahead to do it per 6236, but retained the item for Desktop since we need a progress label.
2021-06-18 15:50:13 -04:00

14 lines
412 B
JavaScript

export function webDownloadClaim(streamingUrl, fileName) {
// @if TARGET='web'
let element = document.createElement('a');
element.setAttribute('href', `${streamingUrl}?download=true`);
element.setAttribute('download', fileName);
element.style.display = 'none';
// $FlowFixMe
document.body.appendChild(element);
element.click();
// $FlowFixMe
document.body.removeChild(element);
// @endif
}