Skip to content

Commit 3b34cca

Browse files
committed
chore: add background Upload docs
1 parent 6f61928 commit 3b34cca

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
**react-native-compressor** package is a set of functions that allow you compress `Image`,`Audio` and `Video`
2020

21+
If you find this package useful hit the star 🌟
22+
2123
## Installation
2224

2325
#### For React Native 0.64 or lower
@@ -150,6 +152,23 @@ const result = await Audio.compress(
150152
);
151153
```
152154

155+
### Background Upload
156+
157+
```js
158+
import { backgroundUpload } from 'react-native-compressor';
159+
160+
const headers = {};
161+
162+
const uploadResult = await backgroundUpload(
163+
url,
164+
fileUrl,
165+
{ httpMethod: 'PUT', headers },
166+
(written, total) => {
167+
console.log(written, total);
168+
}
169+
);
170+
```
171+
153172
# API
154173

155174
## Image
@@ -217,6 +236,30 @@ const result = await Audio.compress(
217236

218237
**Note: Audio compression will be add soon**
219238

239+
## Background Upload
240+
241+
- ###### `backgroundUpload: (url: string, fileUrl: string, options: FileSystemUploadOptions, onProgress?: ((writtem: number, total: number) => void) | undefined) => Promise<any>
242+
243+
- ###### ` FileSystemUploadOptions`
244+
245+
```js
246+
type FileSystemUploadOptions = (
247+
| {
248+
uploadType?: FileSystemUploadType.BINARY_CONTENT,
249+
}
250+
| {
251+
uploadType: FileSystemUploadType.MULTIPART,
252+
fieldName?: string,
253+
mimeType?: string,
254+
parameters?: Record<string, string>,
255+
}
256+
) & {
257+
headers?: Record<string, string>,
258+
httpMethod?: FileSystemAcceptedUploadHttpMethod,
259+
sessionType?: FileSystemSessionType,
260+
};
261+
```
262+
220263
## Contributing
221264

222265
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

0 commit comments

Comments
 (0)