11# react-native-compressor
22
3- react-native-compressor package is a set of functions that allow you compress ` Image ` ,` Audio ` and ` Video `
3+ <!-- Title -->
4+ <p align =" center " >
5+ <img src =" /media/icon.png " alt =" alt text " width =" 150 " />
6+ </p >
7+
8+ <!-- Header -->
9+
10+ <p align =" center " >
11+ <b >Compress videos, images and audio before upload</b >
12+ <br />
13+ </p >
14+
15+ <p align =" center " >
16+ <img height =" 450 " src =" /media/cover.png " >
17+ </p >
18+
19+ ** react-native-compressor** package is a set of functions that allow you compress ` Image ` ,` Audio ` and ` Video `
420
521## Installation
622
@@ -81,17 +97,6 @@ const result = await Image.compress('file://path_of_file/image.jpg', {
8197});
8298```
8399
84- ### Audio
85-
86- ``` js
87- import { Audio } from ' react-native-compressor' ;
88-
89- const result = await Audio .compress (
90- ' file://path_of_file/file_example_MP3_2MG.mp3' ,
91- { quality: ' medium' }
92- );
93- ```
94-
95100### Video
96101
97102##### For Like Whatsapp Video Compression
@@ -134,6 +139,17 @@ const result = await Video.compress(
134139);
135140```
136141
142+ ### Audio
143+
144+ ``` js
145+ import { Audio } from ' react-native-compressor' ;
146+
147+ const result = await Audio .compress (
148+ ' file://path_of_file/file_example_MP3_2MG.mp3' ,
149+ { quality: ' medium' }
150+ );
151+ ```
152+
137153# API
138154
139155## Image
@@ -173,15 +189,6 @@ const result = await Video.compress(
173189- ###### ` returnableOutputType: ReturnableOutputType ` (default: uri)
174190 Can be either ` uri ` or ` base64 ` , defines the Returnable output image format.
175191
176- ## Audio
177-
178- - ###### ` compress(url: string, options?: audioCompresssionType): Promise<string> `
179-
180- ### audioCompresssionType
181-
182- - ###### ` quality: qualityType ` (default: medium)
183- we can also control bitrate through quality. qualityType can be ` low ` | ` medium ` | ` high `
184-
185192## Video
186193
187194- ###### ` compress(url: string, options?: videoCompresssionType , onProgress?: (progress: number)): Promise<string> `
@@ -199,6 +206,17 @@ const result = await Video.compress(
199206- ###### ` bitrate: string `
200207 bitrate of video which reduce or increase video size. if compressionMethod will auto then this prop will not work
201208
209+ ## Audio
210+
211+ - ###### ` compress(url: string, options?: audioCompresssionType): Promise<string> `
212+
213+ ### audioCompresssionType
214+
215+ - ###### ` quality: qualityType ` (default: medium)
216+ we can also control bitrate through quality. qualityType can be ` low ` | ` medium ` | ` high `
217+
218+ ** Note: Audio compression will be add soon**
219+
202220## Contributing
203221
204222See the [ contributing guide] ( CONTRIBUTING.md ) to learn how to contribute to the repository and the development workflow.
0 commit comments