I'm writing a Python backend for Resumable.js, which allows uploading large files from a browser by splitting them into smaller chunks on the client.
Once the server has finished saving all chunks into a temporary folder, it needs to combine them. Individual chunks are quite small (1 MB by default) binary files, but their total size could be possibly larger than the web server's available memory.
How would you do the combining step in Python? Say a folder only contains n files, with names: "1", "2", "3"...
Can you explain how:
read()
write(.., 'wb')
write(.., 'ab')
shutil.copyfileobj()
mmap
would work in this case and what would be the recommended solution, based on these memory requirements?