All Projects β†’ olavoparno β†’ react-use-downloader

olavoparno / react-use-downloader

Licence: MIT license
Creates a download handler function and gives progress information

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to react-use-downloader

Github Files Fetcher
Download a specific folder or file from a GitHub repo through command line
Stars: ✭ 73 (+12.31%)
Mutual labels:  fetch, downloader, download
Annie
πŸ‘Ύ Fast and simple video download library and CLI tool written in Go
Stars: ✭ 16,369 (+25083.08%)
Mutual labels:  downloader, download
CoubDownloader
A simple downloader for coub.com
Stars: ✭ 64 (-1.54%)
Mutual labels:  downloader, download
hent
A small utility to fetch remote files into buffers
Stars: ✭ 23 (-64.62%)
Mutual labels:  fetch, download
Downloader
Powerful and flexible Android file downloader
Stars: ✭ 193 (+196.92%)
Mutual labels:  downloader, download
Saldl
A lightweight well-featured CLI downloader optimized for speed and early preview.
Stars: ✭ 203 (+212.31%)
Mutual labels:  downloader, download
fbvideos
πŸ”— Easily extract downloadable link of publicly available videos on facebook.
Stars: ✭ 28 (-56.92%)
Mutual labels:  fetch, link
Macos Downloader
Command line tool for downloading macOS installers and beta updates
Stars: ✭ 162 (+149.23%)
Mutual labels:  downloader, download
table-link
πŸ“‚ The easiest way to add links in your table rows, cells or elements that are not anchors!
Stars: ✭ 25 (-61.54%)
Mutual labels:  link, anchor
gb-dl
A python based utility to download courses from infosec4tc.teachable.com , academy.ehacking.net and stackskills.com for personal offline use.
Stars: ✭ 33 (-49.23%)
Mutual labels:  downloader, download
Pyload
The free and open-source Download Manager written in pure Python
Stars: ✭ 2,393 (+3581.54%)
Mutual labels:  downloader, download
udemy-downloader
A Udemy downloader that can download lectures, with DRM support.
Stars: ✭ 507 (+680%)
Mutual labels:  downloader, download
Excel Parser Processor
Simply does the tedious, repetitive operations for all rows of excel files step by step and reports after the job is done. It can download files from URL(s) in a column of Excel files. If a new filename is provided at column B it will rename the file before saving. It will even create sub folders if column C is full with a valid folder name.
Stars: ✭ 177 (+172.31%)
Mutual labels:  downloader, download
Telegram Upload
Upload and download files from Telegram up to 2GiB using your account
Stars: ✭ 223 (+243.08%)
Mutual labels:  downloader, download
Youget
YouGet - YouTube Video/Playlist Downloader/Cutter - MP3 Converter
Stars: ✭ 169 (+160%)
Mutual labels:  downloader, download
miniprogram-network
Redefine the Network API of Wechat MiniProgram (ε°η¨‹εΊη½‘η»œεΊ“)
Stars: ✭ 93 (+43.08%)
Mutual labels:  fetch, download
Fgdownloader
η”¨δΊŽζ–­η‚ΉδΈ‹θ½½γ€δ»»εŠ‘ι˜Ÿεˆ—γ€δΈŠδΌ θΏ›εΊ¦γ€δΈ‹θ½½θΏ›εΊ¦
Stars: ✭ 143 (+120%)
Mutual labels:  downloader, download
Java Youtube Downloader
Simple, almost zero-dependency java parser for retrieving youtube video metadata
Stars: ✭ 160 (+146.15%)
Mutual labels:  downloader, download
Swr
React Hooks for data fetching
Stars: ✭ 20,348 (+31204.62%)
Mutual labels:  fetch, hook
DownloadManagerPlus
Using faster and easier than Android Download Manager
Stars: ✭ 80 (+23.08%)
Mutual labels:  downloader, download

react-use-downloader

Creates a download handler function with its progress information and cancel ability.

NPM


Statements Branches Functions Lines
Statements Branches Functions Lines

Table of Contents


Running example

Plain
Example
Preview!

You may find another example in this project which are served at Github Pages.


Install

npm install --save react-use-downloader

Usage

import React from 'react';
import useDownloader from 'react-use-downloader';

export default function App() {
  const { size, elapsed, percentage, download, cancel, error, isInProgress } =
    useDownloader();

  const fileUrl =
    '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';
  const filename = 'beautiful-carpathia.jpg';

  return (
    <div className="App">
      <p>Download is in {isInProgress ? 'in progress' : 'stopped'}</p>
      <button onClick={() => download(fileUrl, filename)}>
        Click to download the file
      </button>
      <button onClick={() => cancel()}>Cancel the download</button>
      <p>Download size in bytes {size}</p>
      <label for="file">Downloading progress:</label>
      <progress id="file" value={percentage} max="100" />
      <p>Elapsed time in seconds {elapsed}</p>
      {error && <p>possible error {JSON.stringify(error)}</p>}
    </div>
  );
}

Documentation

useDownloader() returns:

  • An object with the following keys:
key description arguments
size size in bytes n/a
elapsed elapsed time in seconds n/a
percentage percentage in string n/a
download download function handler (downloadUrl: string, filename: string, timeout?: number)
cancel cancel function handler n/a
error error object from the request n/a
isInProgress boolean denoting download status n/a
const { size, elapsed, percentage, download, cancel, error, isInProgress } =
  useDownloader();

useDownloader(options?: UseDownloaderOptions) also accepts fetch's RequestInit options:

  • Ex.:
const { download } = useDownloader({
  mode: 'no-cors',
  credentials: 'include',
  headers: {
    Authorization: 'Bearer TOKEN',
  },
});

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Eric Semeniuc
Eric Semeniuc

πŸ€”
davdi1337
davdi1337

πŸ’» πŸ›
Mauro Stepanoski
Mauro Stepanoski

πŸ€” πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!


License

react-use-downloader is MIT licensed.


This hook is created using create-react-hook.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].