ipfs-webui
                                
                                 ipfs-webui copied to clipboard
                                
                                    ipfs-webui copied to clipboard
                            
                            
                            
                        Switch text preview to range reads
Alex noted how partial reads done during preview of text files may lead to leaking resources https://github.com/ipfs-shipyard/ipfs-webui/pull/1646#issuecomment-699043284
The whole point here is that we want to avoid unnecessary reads because text files such as logs can be pretty big. Draining the iterator until completion when a text file is tens/hundreds of megabytes may not be the best approach to ensure resource cleanup happens.
Perhaps could leverage the fact that ipfs.files.read|cat support range requests via offset and length parameters?
The idea is that if the preview ask for specific byte range (256KB block), it  no longer needs low level handling of iterator. Something like  await concat(await read({ offset: n, length: 262144 })) will read 256K block and without leaking any resources.
This issue needs a clear solution to implement before it's actionable.