react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.35k stars 437 forks source link

Need the option of getting pdf file data in base64 #587

Closed usmanhashmi2123 closed 2 years ago

usmanhashmi2123 commented 2 years ago

Base64 Result

Some times there is a requirement to send file as base64

Possible implementation

Code sample

vonovak commented 2 years ago

Hello and thanks for asking, we do not support and will not support base64 because of its bad influence on performance. Thank you 🙂

arnaudambro commented 1 year ago

hello

that's too bad because I technically need base64: I need to encrypt the file I'm uploading, and I need the base64 of the file to encrypt it with my algo...

do you have a suggestion ?

arnaudambro commented 1 year ago

well it seems not so hard

const RNFS = require('react-native-fs');

..

const base64 = await RNFS.readFile(document.uri, 'base64');