# react-native-dropbox-zluck

> React native dropbox upload library, for small and large files

Latest version **1.0.0** (published 2022-06-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-dropbox-zluck
pnpm add react-native-dropbox-zluck
yarn add react-native-dropbox-zluck
bun add react-native-dropbox-zluck
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-06-06 |
| First published | 2022-06-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Zluck Solutions |
| Maintainers | devzluck |
| Keywords | react-native, dropbox, large file upload, small file upload, chunk upload |

## Links

- npm: https://www.npmjs.com/package/react-native-dropbox-zluck
- Repository: https://github.com/zlucksolutions/react-native-dropbox-zluck
- Homepage: https://github.com/zlucksolutions/react-native-dropbox-zluck#readme
- Issues: https://github.com/zlucksolutions/react-native-dropbox-zluck/issues
- npm.io page: https://npm.io/package/react-native-dropbox-zluck

## Dependencies (7)

- [react](https://npm.io/package/react.md) 17.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [moment](https://npm.io/package/moment.md) ^2.29.1
- [react-native](https://npm.io/package/react-native.md) 0.64.1
- [rn-fetch-blob](https://npm.io/package/rn-fetch-blob.md) ^0.12.0
- [react-native-fs](https://npm.io/package/react-native-fs.md) ^2.19.0
- [react-native-app-auth](https://npm.io/package/react-native-app-auth.md) ^6.4.3

## Recent versions

- 1.0.0 (latest) — 2022-06-06

## README

# Dropbox Upload

This package will let user upload small, as well as large files to the Dropbox using Dropbox API.

<p align="center">
  <img src="https://img.shields.io/npm/dw/react-native-dropbox-zluck" />
  <img src="https://img.shields.io/npm/v/react-native-dropbox-zluck" />
</p>

## Features

- Download file to local folder from url
- Get dropbox access token
- Upload file to dropbox

## Installation
Install the package

```sh
npm i react-native-dropbox-zluck
```

## Usage
```sh
import Dropbox from 'react-native-dropbox-zluck';
```

## Download file
Parameters:
| Param | README | Optional
| ------ | ------ | ------ |
| url | Enter file url | required |
| fileName | Enter the name of the file | required |
| openOnDownload | default: false, set it true, if you want to open file when download is completed | optional |
| downloadProgress | Callback which will return download progress | optional |

```sh
const db = new Dropbox();
result = await db.downloadFile(
    fileUrl,
    fileName,
    false,
    (progress: number) => {
        //Use the progress to show progress bar
    }
);
```
Response
```sh
result -> { success: false, path: '' };
```

## View file
Parameters:
| Param | README | Optional
| ------ | ------ | ------ |
| filePath | Enter file path | required |

```sh
const db = new Dropbox();
db.viewFile(filePath);
```

## Get Dropbox token
Parameters:
| Param | README | Optional
| ------ | ------ | ------ |
| oauthClientId | Client Id obtained from dropbox developer console | required |
| oAuthClientSecret | Client secret obtained from dropbox developer console | required |
| oAuthRedirectUrl | App redirect url assignd in dropbox developer console | required |

**[Dropbox Guide](https://developers.dropbox.com/oauth-guide)**

```sh
const db = new Dropbox();
const tokenResult = await db.getDBToken(
    OAUTH_CLIENT_ID,
    OAUTH_CLIENT_SECRET,
    OAUTH_REDIRECT_URI
);
```
Response
```sh
tokenResult -> { dropbox_access_token: '', dropbox_uid: '' };
```

## Upload file to Dropbox
Parameters:
| Param | README | Optional
| ------ | ------ | ------ |
| accessToken | Access token from dropbox api | required |
| filePath | The path to the filem which you want to upload | required |
| fileName | Custom file name for the fiel to be upload (excluding extension, it will be auto-obtained from file path) | optional |
| folderName | Folder name, where file will be uploaded (default: My App). Best practice, is to have your project/app name | optional |
| uploadProgress | Callback which will return upload progress | optional |
| partSize | If file exceeds, the default allowed maximum size, then divide files in this size | optional |

**[Dropbox Developer API](https://www.dropbox.com/developers/documentation/http/documentation)**

```sh
const db = new Dropbox();
const uploadResult = await db.uploadFileToDropbox(
    accessToken,
    filePath,
    '',
    '',
    (progress) => {
        //Use the progress to show progress bar
    }
);
```

## License

MIT

---
_Source: https://npm.io/package/react-native-dropbox-zluck · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
