Skip to content

Commit 7b5867b

Browse files
authored
Update README.md
1 parent be841cb commit 7b5867b

File tree

1 file changed

+52
-9
lines changed

1 file changed

+52
-9
lines changed

README.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,71 @@
11
# react-native-img-buffer-save
22

3-
react native img buffer save
3+
A fast and lightweight React Native library built with JSI that allows you to save images directly to the device's gallery. Supports saving images from `Uint8Array` or `ArrayBuffer` buffers.
44

55
## Installation
66

7-
```sh
7+
### Using Yarn
8+
9+
```bash
10+
yarn add react-native-img-buffer-save
11+
```
12+
13+
### Using NPM
14+
15+
```bash
816
npm install react-native-img-buffer-save
917
```
1018

11-
## Usage
19+
### iOS Specific
20+
21+
After installation, don't forget to install CocoaPods dependencies:
1222

23+
```bash
24+
cd ios && pod install
25+
```
1326

14-
```js
15-
import { multiply } from 'react-native-img-buffer-save';
27+
## Usage Example
1628

17-
// ...
29+
```tsx
30+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
31+
import { saveImageToGallery } from 'react-native-img-buffer-save';
1832

19-
const result = multiply(3, 7);
33+
export default function App() {
34+
const saveImg = () => {
35+
const imgBytes = Uint8Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); // some image;
36+
37+
saveImageToGallery(img); // Accepts Uint8Array
38+
// or
39+
saveImageToGallery(img.buffer); // Accepts ArrayBuffer
40+
};
41+
42+
return (
43+
<View style={styles.container}>
44+
<TouchableOpacity onPress={saveImg}>
45+
<Text>Save IMG to gallery</Text>
46+
</TouchableOpacity>
47+
</View>
48+
);
49+
}
50+
51+
const styles = StyleSheet.create({
52+
container: {
53+
flex: 1,
54+
justifyContent: 'center',
55+
alignItems: 'center',
56+
},
57+
});
2058
```
2159

60+
## Notes
61+
- The library leverages JSI for high performance and low overhead.
62+
- Supports saving images from both `Uint8Array` and `ArrayBuffer`.
63+
- Currently works with both Android and iOS platforms.
64+
65+
---
2266

23-
## Contributing
67+
Feel free to open issues or contribute!
2468

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

2770
## License
2871

0 commit comments

Comments
 (0)