简体   繁体   English

从 nodejs 中的私有 github 存储库下载文件

[英]download a file from private github repository in nodejs

I need to download a single file from a private github repository in nodeJS.我需要从 nodeJS 中的私有 github 存储库下载单个文件。 Is there any way to do that?有没有办法做到这一点?

I tried with wget and curl.我尝试使用 wget 和 curl。 They worked perfectly for public repositories.它们非常适合公共存储库。 But I couldn't find any method to download from private repository.但是我找不到任何从私人存储库下载的方法。

Thanks in Advance提前致谢

You will need to create a github token for that, given that you have access to the repo.鉴于您有权访问该存储库,您将需要为此创建一个 github 令牌。

Example with curl curl示例

curl --header 'Authorization: token <GH-TOKEN>' \
     --header 'Accept: application/vnd.github.v3.raw' \
     --remote-name \
     --location https://api.github.com/repos/owner/repo/contents/path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 JavaScript 从私有 GitHub 存储库获取文件内容 - Get file content from private GitHub repository via JavaScript 从 s3 下载文件,然后将文件存储到 github 存储库中 - Download file from s3 then store the files into the github repository 如何从github.com以及NodeJs(https)下载文件 - How download file from github.com whith NodeJs (https) 使用 GitHub 操作从私有 GitHub 存储库安装 npm 模块 - Install an npm module from a private GitHub repository using GitHub Actions 从 github 下载带有本机 nodejs 库的 tar 文件(节点:http,节点:fs) - Download tar file from github with native nodejs libs (node:http, node:fs) 如何从私有存储库(Node.js)返回Github问题 - How to Return Github Issues from Private Repository (Node.js) 从私有存储库切换到公共存储库但 github 页面不发布站点 - Switching from Private to Public repository but github pages does not publish site 如何从Github API获取私有组织存储库的列表? - How to get list of private organization repository from Github API? 从NodeJS中的服务器下载文件 - File download from server in NodeJS 从带有 node.js 的私有存储库下载 zip 版本 - Download zip release from private repository with node.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM