1 |
|
2 | # react-native-img-to-base64
|
3 |
|
4 | This repo is a working rewrite of [this](https://github.com/xfumihiro/react-native-image-to-base64) abandonned library.
|
5 | It provides a very simple way to convert an image to a base64 string.
|
6 |
|
7 | If you encounter `OOM` errors on old android devices, make sure you optimize the image's size before you convert it.
|
8 | Indeed working with big images on Android might cause very high memory usage.
|
9 |
|
10 | ## Getting started
|
11 |
|
12 | `npm install react-native-image-base64 --save`
|
13 | or
|
14 | `yarn add react-native-image-base64`
|
15 |
|
16 |
|
17 | ## Installation
|
18 |
|
19 | `$ react-native link react-native-image-base64`
|
20 |
|
21 | ## Usage
|
22 | ```javascript
|
23 | import ImgToBase64 from 'react-native-image-base64';
|
24 |
|
25 | ImgToBase64.getBase64String('file://youfileurl', (err, base64string) => doSomethingWith(base64string));
|
26 | ```
|
27 | |
\ | No newline at end of file |