ruby on rails - download github zip file and display contents in web app -
how display contents of github zip file , display contents in web application correct file structure?
could somehow insert zip file database , print contents onto webpage instead of scraping every single file?
making assumption trying build view of contents of zipfile similar githubs representation, after uploading said zipfile server, easiest way to:
- use rubyzip zip::zipfile access uploaded zipfile (how store file db depends on needs).
- store contents in nested hash , display said hash in view. hash can include drill down links extracted files.
to give simple example stub how parse file (e.g. named test.zip)
zip::zipfile.open("test.zip") |zipfile| zipfile.each |entry| # enty / create hash need end end
you can find more details in documentation.
hth
Comments
Post a Comment