I want to implement a readable stream for strings that can have a size of 1MB+, they are created by processing some files of a big size too. These strings will be sent by HTTP protocol to multiple clients and it is needed to send their content asynchronously. The question is: How should I organize the string spliting / reading and what size should I use for the chunked data? In the File System module, as I observed, it is used the size of 64KB when streaming file.
Check out GridFS in MongoDB.
You can handle files in chunks in MongoDB using GridFS
.
It is pretty straightforward.
Save with file type and download it with appropriate file type.