diachedelic / capacitor-blob-writer

Capacitor plugin to write binary data to the filesystem
MIT License
132 stars 17 forks source link

Appending to a file #11

Open diachedelic opened 4 years ago

diachedelic commented 4 years ago

It would be good to be able to append to a file - then we could write even bigger files!

diachedelic commented 3 years ago

See #22.

AgustinBaffo commented 1 month ago

Hi there. I'm working in an app that has to write large volumes of data which are received via streaming. Since I can't store all the data in memory, I can't use write_blob. I was wondering if I could use this library but I saw that it doesn't have an append method 😞

I wanted to know if you are thinking of implementing the append feature? Or if there is any workaround for my use case?

AgustinBaffo commented 1 month ago

I found capacitor-file-chunk package that looks promising and uses this lib as a base code.

This plugin builds on the original concept and code of the Capacitor Blob Writer plugin by providing the ability to read and write files in chunks, offering improved performance compared to the Capacitor Filesystem plugin. It enables direct communication and exchange of binary data with a localhost web server, eliminating the need for base64 conversion.

I'll give a try to it.

diachedelic commented 1 month ago

Wow, I did not know about that plugin. Amazing!

Have you tried using write_blob? My understanding is that browsers flush Blobs to disk when there is insufficient memory available, so in theory this plugin should work for huge files.

AgustinBaffo commented 1 month ago

That won't work for me since I don't have the entire file in memory. I need to write as the chunks arrive. In case anyone has the same problem capacitor-file-chunk package did the trick! 🥳

diachedelic commented 1 month ago

You use case shows that this plugin should support appending.

diachedelic commented 1 month ago

I have no idea when that will be implemented, though. I'm glad the File Chunk plugin worked for you.