<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>single &#8211; AnonyViet &#8211; English Version</title>
	<atom:link href="https://en.anonyviet.com/tag/single/feed/" rel="self" type="application/rss+xml" />
	<link>https://en.anonyviet.com</link>
	<description>The most popular website for sharing information technology, computer networks, and security knowledge. Stay up to date with the hottest news and tips</description>
	<lastBuildDate>Tue, 24 Jan 2023 11:05:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://en.anonyviet.com/wp-content/uploads/2023/01/cropped-ico-logo-75x75-1.png</url>
	<title>single &#8211; AnonyViet &#8211; English Version</title>
	<link>https://en.anonyviet.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to load single files from a Github repository</title>
		<link>https://en.anonyviet.com/how-to-load-single-files-from-a-github-repository/</link>
					<comments>https://en.anonyviet.com/how-to-load-single-files-from-a-github-repository/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Tue, 24 Jan 2023 11:05:11 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[single]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=1735</guid>

					<description><![CDATA[While Github is most commonly used for hosting large code projects, it also acts as a pretty good FIle host and sometimes you just want to download a file or two without having to download the whole thing. what about the repo? Fortunately, Github supports this by web and command line. Join the channel Telegram [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div id="ftwp-postcontent">
<p><strong>While Github is most commonly used for hosting large code projects, it also acts as a pretty good FIle host and sometimes you just want to download a file or two without having to download the whole thing. what about the repo?  Fortunately, Github supports this by web and command line.</strong></p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<p><img post-id="1735" fifu-featured="1" fetchpriority="high" decoding="async" class="aligncenter wp-image-37178 size-full" src="https://anonyviet.com/wp-content/uploads/2021/11/d6528811-1.jpg" alt="How to load single files from a Github repository" title="How to load single files from a Github repository" width="900" height="385" srcset="https://anonyviet.com/wp-content/uploads/2021/11/d6528811-1.jpg 900w, https://anonyviet.com/wp-content/uploads/2021/11/d6528811-1-300x128.jpg 300w, https://anonyviet.com/wp-content/uploads/2021/11/d6528811-1-768x329.jpg 768w, https://anonyviet.com/wp-content/uploads/2021/11/d6528811-1-750x321.jpg 750w" sizes="(max-width: 900px) 100vw, 900px" title="How to load single files from a Github 8 . repository"/></p>
<h2 id="ftoc-tai-mot-file-don-tu-github" class="ftwp-heading">Download a Single File from Github</h2>
<p>If you prefer to use a web browser, you can download any file pretty easily.  Go to the File you want to download and click “Raw:”</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-37179 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/0ad2a42a.jpg" alt="How to load single files from a Github 3 . repository" width="469" height="209" srcset="https://anonyviet.com/wp-content/uploads/2021/11/0ad2a42a.jpg 469w, https://anonyviet.com/wp-content/uploads/2021/11/0ad2a42a-300x134.jpg 300w" sizes="auto, (max-width: 469px) 100vw, 469px" title="How to load single files from a Github 9 . repository"/></p>
<p>This will open a page with a direct link to File.  You can copy, but in most browsers, you can right-click and select “Save As” to download the File directly.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-37180 aligncenter" src="https://anonyviet.com/wp-content/uploads/2021/11/fba73191.jpg" alt="How to load single files from a Github 4 . repository" width="407" height="183" srcset="https://anonyviet.com/wp-content/uploads/2021/11/fba73191.jpg 407w, https://anonyviet.com/wp-content/uploads/2021/11/fba73191-300x135.jpg 300w" sizes="auto, (max-width: 407px) 100vw, 407px" title="How to load single files from a Github 10 . repository"/></p>
<p>For cpde files, the downloaded file can be saved as a .txt, you will need to manually edit the file extension before or after downloading.</p>
<h2 id="ftoc-tai-file-don-le-tu-command-line" class="ftwp-heading">Download Single File from Command Line</h2>
<p>Files are provided from raw.githubusercontent.com, can be downloaded directly via wget or curl.  They are stored in accessible locations, so if you know the username, repository and File path, you can download any File on any branch like this:</p>
<pre>wget https://raw.githubusercontent.com/username/repository/branch/path/filename.md</pre>
<p>If you want to use Git&#8217;s API, you can interact with it more directly and download files when you are unsure of the exact File location.  You will need to generate a personal access token to use the API and replace “ACCESS_TOKEN” in this script.</p>
<pre>curl -H 'Authorization: token ACCESS_TOKEN ' -H \&#13;
'Accept: application/vnd.github.v3.raw' -O -L \&#13;
https://api.github.com/repos/username/repository/contents/path/filename.md</pre>
<p><a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fdocs.github.com%2Fen%2Frest%2Freference%2Frepos%23contents" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">/repos/{user}/{repo}/contents endpoint</a> will do different things depending on whether the path points to a directory or a File.  If it&#8217;s a File, it will return that File&#8217;s metadata:</p>
<pre>{&#13;
  "type": "file",&#13;
  "encoding": "base64",&#13;
  "size": 5362,&#13;
  "name": "README.md",&#13;
  "path": "README.md",&#13;
  "content": "encoded content ...",&#13;
  "sha": "3d21ec53a331a6f037a91c368710b99387d012c1",&#13;
  "url": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md",&#13;
  "git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",&#13;
  "html_url": "https://github.com/octokit/octokit.rb/blob/master/README.md",&#13;
  "download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md",&#13;
  "_links": {&#13;
    "git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",&#13;
    "self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md",&#13;
    "html": "https://github.com/octokit/octokit.rb/blob/master/README.md"&#13;
  }&#13;
}</pre>
<p>If it&#8217;s a directory, it will return all files and subdirectories in an array:</p>
<pre>[&#13;
  {&#13;
    "type": "file",&#13;
    "size": 625,&#13;
    "name": "octokit.rb",&#13;
    "path": "lib/octokit.rb",&#13;
    "sha": "fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",&#13;
    "url": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb",&#13;
    "git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",&#13;
    "html_url": "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb",&#13;
    "download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/lib/octokit.rb",&#13;
    "_links": {&#13;
      "self": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb",&#13;
      "git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",&#13;
      "html": "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb"&#13;
    }&#13;
  },&#13;
  {&#13;
    "type": "dir",&#13;
    "size": 0,&#13;
    "name": "octokit",&#13;
    "path": "lib/octokit",&#13;
    "sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",&#13;
    "url": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit",&#13;
    "git_url": "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",&#13;
    "html_url": "https://github.com/octokit/octokit.rb/tree/master/lib/octokit",&#13;
    "download_url": null,&#13;
    "_links": {&#13;
      "self": "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit",&#13;
      "git": "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",&#13;
      "html": "https://github.com/octokit/octokit.rb/tree/master/lib/octokit"&#13;
    }&#13;
  }&#13;
]</pre>
<p>Then you can use a JSON parser like jq to split the URL and download it.  To get the list of repo files recursively, you need to fetch <a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fdocs.github.com%2Fen%2Frest%2Freference%2Fgit%23trees" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">root tree</a>.  You can also use github to create a simple website in 15 minutes <a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fcach-tao-website-bang-github-trong-15-phut%2F" rel="noopener" class="local-link">here</a>.</p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;37177&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/how-to-load-single-files-from-a-github-repository/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2021/11/d6528811-1.jpg" medium="image"></media:content>
            	</item>
	</channel>
</rss>
