Although I agree that in general the file-based approach is better, especially when dealing with large archives, there are cases where it makes sense to do it in-memory (e.g. to send the content to a server or attach it to an email).
Writing it to a (temporary) file and then loading it back into memory is just inefficient for those particular cases.
Although I agree that in general the file-based approach is better, especially when dealing with large archives, there are cases where it makes sense to do it in-memory (e.g. to send the content to a server or attach it to an email).
Writing it to a (temporary) file and then loading it back into memory is just inefficient for those particular cases.