This question already has an answer here:
- Read a file/URL line-by-line in Swift 10 answers
I want to read and display a very large file of text, how do I slice it and read it chunk by chunk to avoid using huge amounts of memory?
The idea is to read first 1mb for example, then convert to string and display, then read only the next 1mb, do the same...
It's important not to allocate the entire file in memory.