@tadashi/fd
v1.1.1
Published
Helper to force download
Downloads
52
Readme
force-download
Helper to force download
Install
$ npm i @tadashi/fd
Usage
Codepen example: https://codepen.io/lagden/pen/QWGzRXZ?editors=1010
<script type="module">
import {download} from 'https://unpkg.com/@tadashi/fd'
btn.addEventListener('click', async () => {
const response = await globalThis.fetch('https://mdn.github.io/dom-examples/picture-in-picture/assets/bigbuckbunny.mp4')
await download(response, 'xxx.mp4', progress => {
const p = progress.percent * 100
bar.value = p
})
})
</script>
<button type="button" id="btn">Download</button>
<progress id="bar" value="0" max="100"></progress>
Donate ❤️
- BTC: bc1q7famhuj5f25n6qvlm3sssnymk2qpxrfwpyq7g4
License
MIT © Thiago Lagden