How to download a single asset instead of getting the Metainformations
BernhardBehrendt opened this issue · 2 comments
BernhardBehrendt commented
It's more a question than an issue.
As written here:
https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
It's possible to download the assets directly via the api:
If you want to download the asset's binary content, pass a media type of "application/octet-stream". The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a 200 or 302 response.
How is this achieved using this library?
Thanks in advance
kaizensoze commented
You can provide headers on a per-request basis so, in this case:
github.repos.getAsset({
user: testRepo.user,
repo: testRepo.repo,
id: assetId,
headers: {
"Accept": "application/octet-stream"
}
}, function(err, res) {
console.log(res);
});
I've added a full example at examples/getReleaseAsset.js.
kaizensoze commented
Closing for now.