-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOCS]: Download a repository archive (zip) #2369
Comments
Any news about this? |
We introduced a new request option to return data That should be helpful for your use case. From there you can simply use the regular const octokit = new Octokit({
auth: 'YOUR-TOKEN'
})
const { data } = await octokit.request('GET /repos/{owner}/{repo}/zipball/{ref}', {
request: {
parseSuccessResponseBody: false
},
owner: 'OWNER',
repo: 'REPO',
ref: 'REF'
})
fs.writeFileSync("repo.zip", data) |
I'm getting the following error for this code:
I'm trying to convert the ReadableStream into a ReadStream (needed for WriteStream) and I'm fumbling :/ |
The following code should work as expected and without blocking the event loop: import { pipeline } from "node:stream/promises";
import fs from "node:fs";
const octokit = new Octokit({
auth: 'YOUR-TOKEN'
});
const { data } = await octokit.request('GET /repos/{owner}/{repo}/zipball/{ref}', {
request: {
parseSuccessResponseBody: false
},
owner: 'OWNER',
repo: 'REPO',
ref: 'REF'
});
await pipeline(
data,
fs.createWriteStream("repo.zip")
); |
Describe the need
Hello, I was looking at the documentation especially to learn more about the github API and javascript and make my development environment cooler, finally I was looking at this category for make my development environment more pleasant. I came across the following code to download the repository:
Wouldn't it be nice in the documentation to have a way to transform it into a file to make it easier?
SDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: