88
99---
1010
11+ | Statements | Branches | Functions | Lines |
12+ | --------------------------------------------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------- |
13+ | ![ Statements] ( https://img.shields.io/badge/Coverage-64.65%25-red.svg ) | ![ Branches] ( https://img.shields.io/badge/Coverage-59.38%25-red.svg ) | ![ Functions] ( https://img.shields.io/badge/Coverage-57.58%25-red.svg ) | ![ Lines] ( https://img.shields.io/badge/Coverage-64.44%25-red.svg ) |
14+
1115## Table of Contents
1216
1317- [ Running example] ( #running-example )
2024
2125## Running example
2226
23- | Plain |
24- | ------------------------------- |
25- | ![ Example] ( ./assets/readme.gif ) |
27+ | Plain |
28+ | --------------------------------------------------------------- |
29+ | ![ Example] ( ./assets/readme.gif ) |
2630| [ Preview!] ( https://codesandbox.io/s/react-use-downloader-0zzoq ) |
2731
2832---
@@ -38,8 +42,8 @@ npm install --save react-use-downloader
3842## Usage
3943
4044``` jsx
41- import React from " react" ;
42- import useDownloader from " react-use-downloader" ;
45+ import React from ' react' ;
46+ import useDownloader from ' react-use-downloader' ;
4347
4448export default function App () {
4549 const {
@@ -49,21 +53,21 @@ export default function App() {
4953 download ,
5054 cancel ,
5155 error ,
52- isInProgress
56+ isInProgress ,
5357 } = useDownloader ();
5458
55- const fileUrl = " https://olavoparno.github.io/saywololo/sounds/Wololo1.wav" ;
59+ const fileUrl =
60+ ' https://upload.wikimedia.org/wikipedia/commons/4/4d/%D0%93%D0%BE%D0%B2%D0%B5%D1%80%D0%BB%D0%B0_%D1%96_%D0%9F%D0%B5%D1%82%D1%80%D0%BE%D1%81_%D0%B2_%D0%BF%D1%80%D0%BE%D0%BC%D1%96%D0%BD%D1%8F%D1%85_%D0%B2%D1%80%D0%B0%D0%BD%D1%96%D1%88%D0%BD%D1%8C%D0%BE%D0%B3%D0%BE_%D1%81%D0%BE%D0%BD%D1%86%D1%8F.jpg' ;
61+ const filename = ' beautiful-carpathia.jpg' ;
5662
5763 return (
5864 < div className= " App" >
5965 < p> Download is in {isInProgress ? ' in progress' : ' stopped' }< / p>
60- < button onClick= {() => download (fileUrl, " filename" )}>
66+ < button onClick= {() => download (fileUrl, filename)}>
6167 Click to download the file
6268 < / button>
6369 < button onClick= {() => cancel ()}> Cancel the download< / button>
64- < p>
65- Download size in bytes {size}
66- < / p>
70+ < p> Download size in bytes {size}< / p>
6771 < label for = " file" > Downloading progress: < / label>
6872 < progress id= " file" value= {percentage} max= " 100" / >
6973 < p> Elapsed time in seconds {elapsed}< / p>
@@ -93,14 +97,14 @@ export default function App() {
9397
9498``` jsx
9599const {
96- size ,
97- elapsed ,
98- percentage ,
99- download ,
100- cancel ,
101- error ,
102- isInProgress
103- } = useDownloader ();
100+ size ,
101+ elapsed ,
102+ percentage ,
103+ download ,
104+ cancel ,
105+ error ,
106+ isInProgress ,
107+ } = useDownloader ();
104108```
105109
106110---
0 commit comments