从GitHub repo下载单个文件有哪些技巧?
我不想要显示原始文件的URL;对于二进制文件,什么都没有。
http://support.github.com/discussions/feature-requests/41-download-single-file
是否有可能将GitHub用作“下载服务器”?
如果我们决定切换到GoogleCode,是否提供了上述功能?
或者开源项目是否有免费托管和VCS?
从GitHub repo下载单个文件有哪些技巧?
我不想要显示原始文件的URL;对于二进制文件,什么都没有。
http://support.github.com/discussions/feature-requests/41-download-single-file
是否有可能将GitHub用作“下载服务器”?
如果我们决定切换到GoogleCode,是否提供了上述功能?
或者开源项目是否有免费托管和VCS?
当前回答
转到要下载的文件。单击它可查看GitHub UI中的内容。在右上角,右键单击“原始”按钮。另存为。。。
其他回答
在github上,打开要下载的文件找到与“Blame”按钮相邻的“Raw”按钮按下键盘上的“Alt”,同时左键单击鼠标该文件将以“.txt”格式自动下载(我就是这样做的)手动将“.txt”扩展名更改为“.csv”扩展名
这对我有用,我希望对你也有用。
简单复制页面链接在命令行中键入:wget-L(精确复制的链接)只需在步骤2中将blob替换为raw进来
或者试试这个
const https = require('https');
const fs = require('fs');
const DOMAIN = 'raw.githubusercontent.com';
function writeFile(data, fileName) {
fs.appendFile(fileName, data.toString(), err => {
if (err) {
console.log('error in writing file', err);
}
});
}
function EOF(data) {
console.log('EOF');
}
function getFileName(pathToFile) {
var result = pathToFile.split('/');
var splitLength = result.length;
return result[splitLength - 1];
}
function getFile(branchName, username, repoName, ...pathToFile) {
pathToFile.forEach(item => {
const path = `/${username}/${repoName}/${branchName}/${item}`;
const URL = `${DOMAIN}${path}`;
const options = {
hostname: DOMAIN,
path: path
};
var fileName = getFileName(item);
https
.get(options, function(res) {
console.log(res.statusCode);
/* if file not found */
if (res.statusCode === 404) {
console.log('FILE NOT FOUND');
} else {
/* if file found */
res.on('data', data => writeFile(data, fileName));
res.on('end', data => EOF(data));
}
})
.on('error', function(res) {
console.log('error in reading URL');
});
});
}
getFile('master', 'bansalAyush', 'InstagramClone', '.babelrc', 'README.md');
您链接到的页面回答了第一个问题。GitHub还提供了一个下载工具,用于发布等内容。谷歌代码根本没有Git。GitHub、Google Code和SourceForge是免费托管。SourceForge可能仍然会做CVS。
在“桌面中的克隆”的右侧,它显示“下载Zip文件”下载Zip文件提取文件