Refined-github: Download specific folder?

Created on 14 Nov 2017  路  9Comments  路  Source: sindresorhus/refined-github

Sometimes you're browsing through a massive codebase and want to download a suite of files, sometime there a single example in the docs which you want to download. Is this possible?

enhancement

Most helpful comment

I just implemented it as an external tool because:

  • it鈥檚 a relatively unused feature
  • JSZip is bigger than the whole Refined GitHub extension
  • downloading the whole repo for three files defeats the purpose, as already said by @yakov116, so the token is needed

All 9 comments

I can't find the endpoint. This is what we currently have:

# single file
github.com/sindresorhus/refined-github/raw/master/package.json
raw.githubusercontent.com/sindresorhus/refined-github/master/package.json

# whole archive
github.com/sindresorhus/refined-github/archive/master.zip
codeload.github.com/sindresorhus/refined-github/zip/master

But these don't work for folders:

github.com/sindresorhus/refined-github/raw/master/media #  redirects to the regular view
raw.githubusercontent.com/sindresorhus/refined-github/master/media # 404
github.com/sindresorhus/refined-github/archive/master/media.zip # downloads the whole repo
codeload.github.com/sindresorhus/refined-github/zip/master/media # 404

Some extensions/tools download all the files separately and then zip them up:

https://chrome.google.com/webstore/detail/gitzip-for-github/ffabmkklhbepgcgfonabamgnfafbdlkn

https://www.google.com.tw/search?q=download+folder+github

I wouldn't mind having a simple Download link added in the toolbar, linking a one-click online tool, if it exists.

@bfred-it Download the whole thing temporarily, unzip and rezip the desired subdirectory?

@tom-sherman imagine doing that to 500MB repo...

It turns out that GitZip exists as a standalone tool as I described it, however it requires an personal token and the interface is superfluous.

Example: https://kinolien.github.io/gitzip/?download=https://github.com/KinoLien/gitzip/tree/gh-pages

I'm not entirely sure of the capabilities of web workers/service workers, but is it not possible to unzip/rezip using them along with IndexedDB for temporary storage?

I鈥檓 not sure of what your intent is. The tool I built for this fetches each file into a Blob object and then passes them to JSZip

@bfred-it The intent being to download and extract the desired sub-directory in-extension without the need for an external tool or token

I just implemented it as an external tool because:

  • it鈥檚 a relatively unused feature
  • JSZip is bigger than the whole Refined GitHub extension
  • downloading the whole repo for three files defeats the purpose, as already said by @yakov116, so the token is needed
Was this page helpful?
0 / 5 - 0 ratings

Related issues

durka picture durka  路  3Comments

hkdobrev picture hkdobrev  路  3Comments

sindresorhus picture sindresorhus  路  3Comments

hkdobrev picture hkdobrev  路  3Comments

sompylasar picture sompylasar  路  3Comments