TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Streaming Github repo content to single web page

1 pointsby zemanelover 12 years ago
for some time i've been thinking about implementing a small web tool to make it easier to read Github repo's project project source code, basically by traversing a repo file collection (http://developer.github.com/v3/git/trees/) by seamlessly scrolling down/up a single webpage (with XHR). I would love to try this on a tablet (if i had one).<p>The repo files would be injected into the page in a certain order (using a tree traversal algo; files first, then [sub]folders files) , syntax highlighted, line numbered, with the possibility to add user bookmarks. The tool would also automatically save the current reading point per repo, like e-book readers.<p>I guess the use case would be to speed read a project's source code, as opposed to following the specific logic (class/function call stacks, etc).<p>The issue is that i haven't been able to decided on a proper implementation, particularly how/what to stream to the browser and memory management.<p>Obviously outputting the full repo's source to the browser in a single page is memory intensive, so it would have to pre-request a few files ahead. But rendering a certain number of files is not a guarantee that they would fill the device's screen (for example requesting 5 files with one or two lines each). So, something i've considered was for the client to request (to the tool's own api) a certain number of lines, depending on the client's device (smartphone/tablet...) / screen resolution.<p>There is also an issue in that source files that have been rendered on the webpage and were already scrolled over, should be removed from the page due to memory consumption, but should probably be cached locally in case the user scrolls back, ideally to avoid re-requesting the files, for a faster seamless experience. For local caching, cookies do not seem a solution, so probably html5 local storage?<p>Would appreciate any suggestions people would like to share,<p>thanks!

no comments

no comments