Transfers of files via Internet using socket.io should not exceed 1-10 MB for performance reasons. Therefore split files bigger than 1MB into blocks of max size 1MB.
There are two approaches:
- Encrypt file and split it into blocks of max size 1MB
- Split file into blocks of max size 1MB and then encrypt each block
When dealing with big files, approach 1 can cause out-of-memory issues when dealing with big files. Approach 2 is recommended.