birdofpreyru / react-native-fs

File system access for React Native
https://dr.pogodin.studio/docs/react-native-file-system
Other
121 stars 8 forks source link

[Android] Better `copyInputStream()` implementation #29

Closed birdofpreyru closed 5 months ago

birdofpreyru commented 5 months ago

In the following methods we can Check system version at runtime, and if API level is 33+ we can use .transferTo() method of the input stream to do the copying. Perhaps it will be somewhat more performant of devices supporting it?

Also, the first of these copyInputStream() versions should re-use the second one for the core of its logic.

https://github.com/birdofpreyru/react-native-fs/blob/d3086d6afd723ae0a0aa3efbbd1416c6f37c0ee1/android/src/main/java/com/drpogodin/reactnativefs/ReactNativeFsModule.kt#L854-L896