react-native-file-download
This repo is deprecated in favor of react-native-fs
Native file download utility for react-native.
Installation
Getting started - iOS
- In Xcode, in the project navigator right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-file-download
and addRNFileDownload.xcodeproj
- Add
libRNFileDownload.a
(from 'Products' under RNFileDownload.xcodeproj) to your project'sBuild Phases
➜Link Binary With Libraries
phase - Look for Header Search Paths and make sure it contains both
$(SRCROOT)/../react-native/React
and$(SRCROOT)/../../React
- mark both as recursive - Run your project (
CMD+R
)
Usage
require it in your file
you may also want to use something like react-native-fs to access the file system (check its repo for more information)
API
download(source: string, target: string): Promise
download file from source to target
Example
addListener(source: string, callback: function): EmitterSubscription
event listener for progress of download
Example