Is there a way to send zip attachments with events? #4217
Unanswered
AdamGerthel
asked this question in
Q&A
Replies: 1 comment
-
Solved by converting to async function fileToUint8Array(filePath: string) {
const fileBuffer = await RNFS.readFile(filePath, 'base64')
const binaryBuffer = Buffer.from(fileBuffer, 'base64')
return new Uint8Array(binaryBuffer)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've read the documentation on attachments, but I'm having trouble figuring out whether I can attach files such as a Realm database (.realm) or a zipped such database. The size is not an issue, the database is small (< 300kb).
So far I've tried zipping it using react-native-zip-archive and then read the file using
RNFS.readFile
and attaching it that way. I did get the file as attachment but it wasn't a functional zip archive anymore. It does seem like there's some way, but I feel like my knowledge around files/buffers/streams/encoding etc. is making this very difficult for me to achieve. Here's roughly where I'm currently at:That, however, results in a broken zip file.
Does anyone have any valuable input on how I could go about achieving this?
Beta Was this translation helpful? Give feedback.
All reactions