2.0.1 • Published 2 years ago

rn-file-downloader v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-file-downloader

Boring to try to use rn-fetch-blob or the fork react-native-fetch-blob or another fork

This module provide a simple way to download file from API to Download (Android) / Documents(iOS)

npm downloads platform - android platform - ios

Installation

$ yarn add rn-file-downloader

Permissions

Android

Add this permissions in AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

iOS

Add this permissions in Info.plist

<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>

Usage

Methods

NameDescriptionArgumentsReturn value
downloadFileDownload a file in Download/Documenturl: string, filename: string, headers: stringifystorePath: string

Sample

import { downloadFile } from "rn-file-downloader";

//...

downloadFile(
        'https://picsum.photos/200/300',
        'my-picture.jpg',
        JSON.stringify({
            Authorization: 'Bearer ' + accessToken,
        })
    )
    .then((path: string) => {
        //...
    })
    .catch((error: string) => {
        //...
    });
2.0.1

2 years ago

2.0.0

2 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago