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:

  1. use rubyzip zip::zipfile access uploaded zipfile (how store file db depends on needs).
  2. 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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -