# react-native-uploadcare-uploader

> A React-Native wrapper for Uploadcares Swift library

Latest version **0.1.4** (published 2023-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-uploadcare-uploader
pnpm add react-native-uploadcare-uploader
yarn add react-native-uploadcare-uploader
bun add react-native-uploadcare-uploader
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2023-09-14 |
| First published | 2022-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 446.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nicho |
| Maintainers | nichocm |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-uploadcare-uploader
- Repository: https://github.com/CritiqApp/react-native-uploadcare-uploader
- Homepage: https://github.com/CritiqApp/react-native-uploadcare-uploader#readme
- Issues: https://github.com/CritiqApp/react-native-uploadcare-uploader/issues
- npm.io page: https://npm.io/package/react-native-uploadcare-uploader

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2023-09-14
- 0.1.3 — 2023-09-14
- 0.1.2 — 2022-06-18
- 0.1.1 — 2022-06-18
- 0.1.0 — 2022-06-18

## README

# react-native-uploadcare-uploader

A React-Native wrapper for Uploadcares Swift library

## Installation

```sh
npm install react-native-uploadcare-uploader
```
or
```sh
yarn react-native-uploadcare-uploader
```

### Android

You will need to define the service in your AndroidManifest. You will also need to allow `FOREGROUND-SERVICE` permissions.

```diff
<manifest.... >
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
  <application ...>
+   <service android:name="com.reactnativeuploadcareuploader.UploadcareUploaderService" />
  </application>
</manifest>
```

# Dependencies

None

## Usage

```js
import Uploader from "react-native-uploadcare-uploader";

// ...

// Note - if uri is prefixed with "file://"
// strip this with uri.replace('file://', '')
const handleUpload = React.useCallback((filePath, uri, mimeType) => {
    Uploader.upload("uploadcare public key", {
        uri, mimeType
    }, {
        onProgress: (current, total) => { /*...*/ },
        metadata: { internalId: "sdasdas", description: "more data..." },
    })
}, [])
```

# Background upload notes

1. Background uploads only apply to multipart uploading, any direct upload will either hang until the app is resumed or fail
2. If you are connected to an xcode debugger, the app is never suspended and thus the background upload appears to not work.

## How it works

This will automatically handle picking between multipart and direct uploads to Uploadcare. Any files less than 10MB will use direct uploads, anything larger multipart. Multipart uploads chunk the files into 5MB sections. Maybe in the future I can make this configurable.

## Contributing

I built this project to solve a very specific problem for my work, feel free to contribute if you'd like

# Credits
Some code from the [uploadcare-swift](https://github.com/uploadcare/uploadcare-swift) library was used to help with making requests to the Uploadcare API.

## License

MIT

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