{"id":23763802,"url":"https://github.com/tomashubelbauer/github-tarball","last_synced_at":"2026-04-28T18:05:55.921Z","repository":{"id":107986135,"uuid":"285074025","full_name":"TomasHubelbauer/github-tarball","owner":"TomasHubelbauer","description":"Example of extracting a GitHub tarball with Node","archived":false,"fork":false,"pushed_at":"2022-04-14T20:23:28.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-01T16:41:42.162Z","etag":null,"topics":["github","tar","tarball"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomasHubelbauer.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-08-04T19:07:29.000Z","updated_at":"2022-04-16T22:53:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"df3a659d-8a57-45b1-bb54-06193aa44a94","html_url":"https://github.com/TomasHubelbauer/github-tarball","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TomasHubelbauer/github-tarball","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasHubelbauer%2Fgithub-tarball","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasHubelbauer%2Fgithub-tarball/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasHubelbauer%2Fgithub-tarball/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasHubelbauer%2Fgithub-tarball/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomasHubelbauer","download_url":"https://codeload.github.com/TomasHubelbauer/github-tarball/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasHubelbauer%2Fgithub-tarball/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32392363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","tar","tarball"],"created_at":"2024-12-31T22:13:34.517Z","updated_at":"2026-04-28T18:05:55.916Z","avatar_url":"https://github.com/TomasHubelbauer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Tarball\r\n\r\nThis is an example code for downloading GitHub repository `.tar.gz` archive from\r\nthe GitHub API (which provides ZIP and TAR archive downloads), decompressing it\r\nusing Node's native `zlib` module and parsing the resulting stream entries out.\r\n\r\n## Configuring\r\n\r\nReplace `userName` and `repositoryName` in the code prior to running it if you\r\nwish to try this on your own repository.\r\n\r\n## Running\r\n\r\n`node .`\r\n\r\n## Testing\r\n\r\nNo tests yet.\r\n\r\n## Purpose\r\n\r\nThis repository exists as a mere proof of concept. I wanted to see if I can get\r\nfrom pure Node (no NPM or ESM dependencies) to a fully cloned GitHub repository.\r\nThere are Git clients build in pure JavaScript (check out Isomorphic-Git), but I\r\nwanted to see if it would be possible without using any dependencies at all.\r\n\r\n## To-Do\r\n\r\n### Decide how to handle files which do not contain their relative directory\r\n\r\nMost files are okay and they come out with paths like `repo/file.ext`. However,\r\nsome files, probably files whose full relative path would exceed the 100 bytes\r\navailable for the file name in Tar, only have their file name and no path stored\r\nin the archive. I think the safe and probably expected thing to do here is to\r\ntake the last known path entry and prepend its path to the file name. A reliable\r\nway to detect these files is probably just whether their file name contains a\r\nslash?\r\n\r\n### Fix padding NUL byte detection at the end of the archive\r\n\r\nRight now after each entry I check to see if the remaining bytes are all NUL. I\r\ndon't use a particularly efficient way of doing it either and even if I did this\r\nis just plain wasteful. I don't have a better way to detect and throw away the\r\nend-of-file padding, so this works for now, but it should be improved.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomashubelbauer%2Fgithub-tarball","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomashubelbauer%2Fgithub-tarball","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomashubelbauer%2Fgithub-tarball/lists"}